Tag Info

Hot answers tagged

6

You need to add $context.ExecuteQuery() at the end. Without it operations won't be executed on the server.


4

When trying to administer SharePoint Online (O365) via PowerShell through a proxy server the Connect-SPOService cmdlet connections fail. Perform these commands and retry Connect-SPOService $cred = [System.Net.CredentialCache]::DefaultCredentials [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred


3

I asume you are filtering by site and not by library. You could do something like this: $ignoreSites = @("http://siteurl/site1", "http://siteurl/site2") Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue $siteURL = $args[0] $site = Get-SPSite($siteURL) $webs = $site.AllWebs | ? {$_.Url -notin $ignoreSites} foreach($web in $webs) { ...


3

Instead of removing sites in foreach try passing it to Remove-SPSite using pipeline: Get-SPSite -Limit ALL | Where-Object { $_.Url -Like "*personal*" } | Remove-SPSite Or shorter version: Get-SPSite -Limit ALL | ? Url -like *personal* | Remove-SPSite


3

In one of the most recent updates to the SharePoint Online Management shell, https://www.microsoft.com/en-us/download/details.aspx?id=35588, they introduced a new commandlet called Request-SPOPersonalSite. You simply supply a list of no more than 200 users, and it will preprovision their OneDrives.


2

You need to use the Import-Csv to import the CSV data into PowerShell, and then you can loop through it. So if you have a specific value you want to compare against and then update a list item in SharePoint, in your case comparing Money and then updating the list item matching the Customer number, the following can be an inspiration: # Load in the CSV ...


2

Publishing Portal maps to "BLANKINTERNETCONTAINER#0" and not "BLANKINTERNET#0", which is specific to subsites. You can verify this or any other site template from the site creation page by using your browser's dev tools and looking at the select option that represents the site you're trying to create:


2

In SharePoint 2013 was introduced a new Microsoft.SharePoint.Client.Publishing and Microsoft.SharePoint.Client.Publishing.Navigation namespaces in CSOM API. But unfortunately it is not supported to get/set Show subsites & Show pages navigation settings using WebNavigationSettings class since those properties are not exposed. Having said that I propose ...


2

It's because $lista is $null. Are you sure this is correct title of the list? In PowerShell you won't get error when you try load list with incorrect title. You also won't get exception executing follofing: $null.Something foreach ($a in $null) {} That's why you get an exception so late, on the Update() method. You should also use Get-SPSite instead of ...


2

I think you should check on 2 things In $item["title"] you should use casing, because SharePoint understands Title hence improve it to $item["Title"]. I guess you don't need $lista.update() Refer below updated code. #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue ...


2

I personally use the Powershell ISE with the SharePoint Online management shell loaded and a custom module. http://www.microsoft.com/en-us/download/details.aspx?id=35588


1

This powershell script will show the name of all content types that contains a field by its name. $site = Get-SPSite http://YourSiteURL $web = $site.RootWeb $columnName = "Your_Site_Column_Name" $guid = $web.fields[$columnName].id $contentTypes = $web.AvailableContentTypes for ($x=0; $x -lt $contentTypes.Count; $x++) { for ($y=0; $y -lt ...


1

The only explanation to this issue falls along the line of what @Akhoy has suggested. You may have the DB path set to F:/ but, perhaps you need to restart your SQL Server/ Agent Service.


1

It's a bug. The commands are actually correct. When I changed a user property, changes were saved. I ended up changing a dummy property in order to save the custom profile subtype. $site = Get-SPSite -Identity http://www.mysharepoint.com/sites/sitename $serviceContext = Get-SPServiceContext $site $upm = new-object ...


1

I found this property for the Navigation class: public bool UseShared { get; set; } Setting it true should inherit the navigation. So this should work: $web.Navigation.UseShared = $true; However, it seems it applies to all navigation, top nav and quick launch.


1

I'm not sure if this option is available in SPO, but this is how I do it on-prem. Within Site Settings, go to 'Content and Structure'. Navigate into the document library you'd like to work with, and then select all documents within it. Click 'Actions' and 'Check In'.


1

You can't. The maximum length of the User Profile Core Property Name and Display Name is 50 characters. It's enforced in the setter. Why do you need more than 50 characters?


1

Yes, you can accomplish those items without needing the server object model. You have a few options that are client-side: Use CSOM in a console application (does not involve PowerShell). This link has some examples of how to use CSOM, and links to sample code. Use CSOM from PowerShell. This blog is a great starter. If you would like help on a ...


1

Create a powershell script which reads the csv as input. Get the List items by id and check if they are equal to the information from your csv. If not, make an update on the item. Do this for every item. If you need some powershell sharepoint references: http://www.itunity.com/article/completing-basic-operations-sharepoint-csom-api-powershell-1278


1

After many tests, finally I can reproduce the error "There is already a term with the same default label and parent term" In my custom termset 'CustBusinesUnit', the "IsAvailableforTagging" is unchecked. It means: User profile cannot REUSE the existing terms in the termset User profile can ADD NEW terms in the termset and use it as the profile value ...


1

Since you are passing values from csv file and all the users are getting updated in a loop. I can think of a below possible way to trace the problem and a possibility to crack a problem. Trace the problem: It might be possible that, for 2 users you are saving same value in CustBusinessUnit. So in first iteration of loop, while you update the user profile, ...


1

As per what Daniel suggested; #Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue #Load in the CSV $delimeter = "," $csvData = Import-Csv C:\CustomerData\customerspend.csv -Delimiter $delimeter #Site Collection where you want to upload files $webURL = ...


1

The following revised script will work, if you want to stop all users from following other users. The problem with the original script was that .StopFollowing() requires a SPSocialActorInfo object and not an SPSocialActor, which is non-intuitive. Also important is that the user who runs this script must have permissions on the user profile service ...



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