Tag Info

Hot answers tagged

4

Get-SPWeb http://sharepoint/sites/xyz| Select -ExpandProperty Lists | Where { $_.Title -eq "Shared Documents" } | Select -ExpandProperty Fields | Select Title, InternalName For more informaiton: http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts Following code will also help you Add-PSSnapin ...


3

You can use below Powershell. $spweb = get-spweb -identity "http://yourdomain/yourweb" # Use the "pretty name" of your library below $list = $spweb.lists["Your Library"] $listItems = $list.Items # For each item foreach ($listItem in $listItems) { $DocumentTitle = $listItem.Name write-host "FileTitle -> $DocumentTitle" } #Clean up ...


3

Use -replace PowerShell Regex based operator: $line = "Energy & Resources;#67777;#Financial Services;#137;#Consumer Business & Transportation;#23;#Real Estate;#4" $fmtLine = $line -replace ";[#\d;]+", ';' Update In order to return the array of values use -split operator or String.Split method, for example: $line = "Energy & ...


3

To just activate the feature use the following command: Enable-SPFeature –Identity <<FeatureID>> –url http://myspsite/ To find the FeatureID use the following for hidden features: Get-SPFeature -Limit ALL | Where-Object {$_.Hidden -eq $true -and $_.Scope -eq “WEB”} | Sort-Object DisplayName | Select DisplayName, Id


2

Disclaimer: I don't know how that specific functionality is implemented, so it is possible that there exist a simpler way to achieve the same results as my proposed solution. Looking at SharePoint object model, the only way that comes to mind to achieve that is to work backwards - checking for each file if it has a relation to the original listitem. The ...


2

Please verify that you're using the Export-SPWeb and Import-SPWeb PowerShell cmdlets, with these arguments: -IncludeVersions All : To keep all files verions -IncludeUserSecurity : To keep permissions on files Example : Import-SPWeb "http://sharepointurl/subsite1" -ItemUrl "lists/MyList" -Path "C:\" -IncludeVersions All -IncludeUserSecurity Please ...


2

Below is the link to bulk upload profile picture using Powershell. https://gallery.technet.microsoft.com/office/Bulk-Upload-and-Update-2c27437e we have used this in one of our project. It may help you. If you are running the script in a fresh SharePoint installation, make sure that User Photos library exist in your My Sites host and also that there is a ...


2

You get this error because you're deleting straight from your source collection, which will change as soon as you start deleting. A possible solution is to first get all the lists you wish to delete and store them in a seperate list (not subject to modification, since this is not the source collection) $listsToDelete = @() foreach($list in $web.Lists) { ...


2

Instead of PSI I suggest you to work with the managed object model of Project Server. That is much more developer friendly. Last year I wrote a post about how can you list lookup table entries: using (var projectContext = new ProjectContext(pwaUrl)) { projectContext.Load(projectContext.LookupTables, lts => lts.Include( lt ...


2

How about saving your script to a ps1 file and then run it as an expression. So, content of Example.ps1: $path ="YOUR PATH" $ItemUrl = "YOUR ITEM URL" Add-PSSnapin Microsoft.SharePoint.PowerShell Export-SPWeb –Identity $SourceIdentity –Path $Path –ItemURL $ItemUrl And then run it: $Path = "C:\PATHTOExample.ps1" Invoke-Expression "$Path"


2

This is done by the PowerShell Script New-MsolUser either by adding the user without a license: New-MsolUser -UserPrincipalName JWarner@contoso.com -DisplayName "Jamie Warner" -FirstName "Jamie" -LastName "Warner" Or with a license New-MsolUser -UserPrincipalName DomTru@contoso.com -DisplayName "Dominique Trujillo" -FirstName "Dominique" ...


2

Maybe you have deleted the site before, and it's lurking around in a dark place? Try this and see what you get... Get-SPDeletedSite & Remove-SPDeletedSite You may already have restored this site before. In that process you also deleted the site first (automatically), which you can find running the command... >Get-SPDeletedSite You'll see the site ...


1

You should use the parameter DefaultProxyGroup when using New-SPMetadataServiceApplicationProxy


1

First, Install Microsoft Online Services Sign-In Assistant. Then, Run this Powershell : Connect-MsolService Get-MsolAccountSku $val = Get-MsolAccountSku |ForEach-Object {;$_.AccountSkuId;} $mytnt = $val.Split(":")[0] New-MsolUser -DisplayName "John Smith" -FirstName "John" -LastName "Smith" -UserPrincipalName john@mytnt.onmicrosoft.com -Department ...


1

This is the script that will print the names of all items in a library. $web = Get-SPWeb <web address> $list = $web.Lists["<document library/list name>"] $items = $list.Items foreach($i in $items){ Write-Host $i.Name }


1

Try to use the code provided here - Modify SafeControls in web.config using Powershell script leveraging SPWebConfigModification method #SafeControl $assembly = " Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" $namespace = "Microsoft.SharePoint.WebPartPages " $mod = new-object ...


1

Yes, it should work. Personally, I don't use the syntax $userProfile["$property"], instead without the quotes like $userProfile[$property], but it should not make a difference, AFAIK. What I don't see in your code, where the $userProfile variable in the Update-UserProfileProperty method was defined. What is the type of your custom property? String / date / ...


1

Can you please try the following (found here) Please note the differences : You get your node in $LibraryNode, but you also get the previous node (here: "Home"). Then you use this namespace. $web = Get-SPWeb http://www.sharepoint.com/ $navigationNode=$web.Navigation.QuickLaunch $LibraryNode = $navigationNode | where { $_.Title -eq "Node Name" } $HomeNode= ...


1

It would be because of this: $new['Assignedto] = $item.ResponsibleTranslate; The internal name of the Assigned To column would be $new['AssignedTo'] = $item.ResponsibleTranslate;, you are also missing the closing apostrophe.


1

The User Profile Synchronization Service must be provisioned by the farm account. So if you run your Powershell script using another account (the setup account typically), it will fail. The solution is either: 1) To run your Powershell script using the farm account. Try shift+right click on Powershell shortcut -> "run as another user"; or directly log in ...


1

We had the same problem couple of months ago, after digging too much we open a MSFT case. Here how we solve it. after updating the wsp, we check if new dll deployed. we also check if updated DLL loaded recycle the SharePoint timer services on all servers. We use the decompiler tool to find which assembly loaded. In our case, even after updating( many ...


1

Below is what I needed to change to get this to work: Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue $SPWeb = Get-SPWeb "http://sharepoint"; $SPList = $SPWeb.GetList("http://sharepoint/Lists/Favorites"); $userName = "i:0#.w|[domain]\[username]"; $user = Get-SPUser -web $SPWeb -Identity $userName; $userString = "{0};#{1}" -f $user.ID, ...


1

Please, refer to this link to modify this field: $SPSite = New-Object Microsoft.SharePoint.SPSite("http://sharepoint") $SPWeb = $SPSite.OpenWeb() $SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,8, "#Test R.Test") $ListItem["Author"] = $SPFieldUserValue $ListItem.Update() $SPWeb.Update() As you can see, you ...


1

You can export the new lists as templates and add them to prod. For existing lists - add columns manually or use some kind of migration tool (e.g. ShareGate - handles well changes in list structure, also newly create items). Or you can user powershell and script changes - use this approach in the future and you can modify with one script dev and prod as ...


1

As you mentioned both are the plain text and you have value "12" in the text field, that's mean it is not user then you dont need to ensure it. You simply need to copy it. Try below script, Add-PSSnapin Microsoft.Sharepoint.Powershell [System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site = new-object ...


1

Yes, it has to do with the number formatting. You've made Storage, Quota, and Used all strings. The results you see are consistent with sorting strings of numerical text. Instead of having the units as part of the results, just use the numbers and then format the results in the table with a formatting expression: $GetStorage = @{Name="Storage"; ...


1

No, it's only possible using the UI I have been looking for a solution; but it seems this is not possible programmatically. You'll find workarounds where you have to create event listeners and sync the list yourself as jaloplo mentioned.


1

You need to execute Register-SPWorkflowService only once for the entire farm. I have many cases where this did not work though due to some other factors in addition to the Proxy issue mentioned in the earlier response. SharePoint web applications are using https and the root of their cert is not in Workflow Manager server trusted root authority (MMC ...


1

$personFieldValue = $ListItem["PersonFieldName"].ToString(); $spFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($oWeb,$personFieldValue);



Only top voted, non community-wiki answers of a minimum length are eligible