Tag Info

New answers tagged

5

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


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) { ...


1

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


0

Does this issue seem similar to you? The suggested solutions could be tailored to your situation. I would have quoted some of the code but the OP never marked one as an answer. Basically my suggestion to the other person was filter the workflows that had been running for more than 4 hours. Without having any real long running workflows that should have ...


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.


0

Make sure the url you specify isn't using %20 as a replacement for spaces.


1

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 ...


1

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 ...


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.


0

Yes this can be easily done using powershell. SPWeb = Get-SPWeb http://server/sitecoll/spweb/spweb $SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb] :GetPublishingWeb($SPWeb) $SPWeb.AllowUnsafeUpdates = $true $SPPubWeb.Navigation.InheritGlobal = $true http://blog.blksthl.com/2012/02/12/site-settings-by-powershell-part-1-navigation/


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'.


0

The issue with your code is, that in a list content types are not added directly but only as a child of the web content type. This means, that no content type on a list will ever have the ID 0x01. It is always better to use the SPBuiltInContentTypeId to refer to an out of the box content type, because the name change with the language SharePoint is ...


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


0

To create a publishing page using either Out of the box or a custom page layout following is the code. There are 2 things you need to keep in mind to follow the below function If you are using OOB page layout, then we are using CAML query to get page layout as an item If you are using a custom page layout, then we are using a path to get page layout as an ...


0

You are confusing an SPFieldCollection with SPField. SPFieldCollection doesn't have a member called InternalName, but SPField does. Instead, your PS query should look like this: $web = Get-SPWeb http://localhost $list = $web.Lists["Style Library"] $fields = $list.Fields $fields | ? {$_.InternalName -like '*workflow*'} You don't get InternalName for the ...


0

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

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 ...


0

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 ...


0

The following JSOM code worked for me to get all the users of a 2013 site, not sure about 2010. Openn the site in chrome. Copy the whole code and run in console. Doesn't work in IE. var JSONToCSVConvertor = function (JSONData, ReportTitle, ShowLabel) { var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; var CSV = ...


0

I've never done that before but with a little googling I found something for you: http://www.lavinski.me/calling-a-rest-json-api-with-powershell/ This works so far with Powershell: Invoke-RestMethod -Uri "your REST URL" -UseDefaultCredentials otherwise you would need to specify your credentials directly.


0

Typing $profile is not enough to actually create a PowerShell profile. You can always try to see if a path exist using Test-Path and in this case if you try to run Test-Path $Profile it would return false, meaning that the path does not exist. To actually create a profile of yours, you can run New-Item -Path $profile -Type File -Force What this does is ...


0

Check if the path exists or not using: # Check path of PowerShell profile file Test-Path $profile If the above returns false, then no profile exists as yet. Use the below command to create a new profile. # Command to create a PowerShell profile New-Item -path $profile -type file -force


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.


0

Alternatively to PowerShell, SharePoint Timer Service runs under farm account. Check it out and you get farm account


0

If you want to get the ID of the item for the corresponding file, you may simply try: $file.Item.ID


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 ...


0

In theory each list in a site collection will have a unique ID much like the List Item ID. You can see it via: $list.RootFolder.Properties["docid_msft_hier_listid"] You will need to clear all the docid settings for each item, get an instance of the DOCID provider and call GenerateDocumentID: $provider = ...


0

I'd done with this as- foreach ($row in $csv) { $CSVid = $row.ID [Microsoft.SharePoint.Client.List]$list = $web.Lists.GetByTitle($listName) $items = $list.GetItemById($CSVid) $context.load($items) try { $context.ExecuteQuery(); } catch { $ErrorMessage = $_.Exception.Message }


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

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, ...


0

I would actually look more into copying all the data from one list and inserting it in the destination list. You could do this through web services in powershell Something like (from this blog): ## Specify the site URL from where you need to get all the list items $webURL="http://serverName:46563/sites/MMS" ## Specify the list name from where you need to ...


0

Maybe the group does not have any permission, run this to get the permission for the group: $urlWeb = "http://yourPortalUrl" $web = Get-SpWeb $urlWeb foreach($roleAssignment in $web.RoleAssignments) { write-host -foregroundcolor green "Group Name: "$roleAssignment.Member.Name "..." foreach($roleDefinition in ...


0

You can use this CSOM PowerShell function to delete the views in a list. It depends on you how you pass parameters in this function using for loop as mentioned by @JamesLove. Try{ Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' Add-Type -Path 'C:\Program Files\Common ...


0

Gary Lapointe has the article Loading Specific Values Using Lambda Expressions and the SharePoint CSOM API with Windows PowerShell which is providing lots of insight and also the function Load-CSOMProperties.ps1 over on github Utility PowerShell function that facilitates the loading of specific properties of a Microsoft.SharePoint.Client.ClientObject ...


0

followed by the answer in this link: this link provides information to create a content organizer rule in powershell. you can also see this from this, Which Says : Here is how to Create a Record Center Sub Site , and add a Content Organizer rule to it. First, We need to Create the Subsite. The Template “OFFILE#1” is the Template for Record ...


0

You can PowerShell script to create a content organizer rule. It uses Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRouterRule [Microsoft.SharePoint.SPSite]$site = Get-SPSite http://www.mycompany.com [Microsoft.SharePoint.SPWeb]$web = Get-SPWeb http://www.mycompany.com [Microsoft.SharePoint.SPContentType]$ct = ...


0

Their is no way to get the ULS logs from SharePoint Online. ULS logs are located at server and can be accessed by farm admin. But on SharePoint online we are tenant administrator but not farm. You can ask / open a service request with SharePoint Online support team and provide them the error details, they will help you. ...


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 = ...


0

You need in Central Administration in Manage Web Application for each web-application give for account in User Policy full access.


0

I found the below link very helpful. Try it. http://fixingsharepoint.blogspot.com/2014/07/how-to-move-sharepoint-list-items-to.html


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:


0

If you would want to set Type="People Search Results", then I recommend you update your code with below. I have created this way. $resultSource.ProviderId = $fedManager.ListProviders()['Local People Provider'].Id


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 ...


0

The problem is actually pretty dumb, so I checked mange content database setting in Central admin. And found out my sharepoint database is hosted in another server, I went to that server, added my account to login and mapped it to owner of SharePoint_Configuration database. The error message stopped appearing and I was able to access to sharepoint farm.


0

Below PowerShell script gets files from the given folder recursively: Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" Function IterateFolderRecurresive([Microsoft.SharePoint.Client.Folder] $fld, [Microsoft.SharePoint.Client.ClientContext] $ctx) { Write-Host "Files from " ...


0

Something like: $sitecol = New-Object Microsoft.SharePoint.SPSite($webURL) $web = $sitecol.OpenWeb() $list = $web.Lists[$listName] $foldername=""; $folder = $list.ParentWeb.GetFolder($web.Url + "/" + $list.RootFolder.Url + "/" + $foldername) foreach ($item in $folder.Files) { Write-Host $item.Name }


1

Try this below one $Url = " http://eng.portal.cs.com"; $output = $Url.Split('/')[2];



Top 50 recent answers are included