Hot answers tagged

6

Try this $ct = @() $spWebApp = $Site.WebApplication foreach($allSites in $spWebApp.Sites) { foreach($Web in $allSites.AllWebs) { foreach($list in $Web.Lists) { if($list.BaseTemplate -eq "DocumentLibrary" -and $list.AllowContentTypes -eq $true) { if(-not ($systemlibs -Contains $list....


4

PowerShell for SharePoint Online has really limited capabilities at the moment. There is no one liner to automate this task. But you can use CSOM inside your scripts. [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint.Client') | Out-Null $login = 'test@test.onmicrosoft.com' $password = ConvertTo-SecureString 'password' -AsPlainText -...


3

I'm guessing it is because of this section: "Modified By" = $item["Editor"] "Modified Date" = ($item["Modified"] -as [datetime]).DateTime In reality, you should be using $version to get to the version history of the item. You are iterating over each version of the item, yet you are referencing the item properties. Something like: "Modified By" = $...


3

By default SharePoint only support IQY format, In order to export the list into csv you have to use the 3rd party tools or run some kind of script. for 2010 $spSiteUrl = "http://sharepointwebapplication" $listtitle="My Custom List" $spWeb= Get-SPWeb -Identity $spSiteUrl Function ImportDataFromListToCSV { IF($spWeb -ne $null) { $list = $spWeb.Lists....


3

Create SPQuery object and set its Folder property and then call GetItems on List and finally loop through the item collection. $spQuery = New-Object Microsoft.SharePoint.SPQuery $spQuery.Folder = $folder; $items = $list.GetItems($spQuery);


3

Add the following to DOCICON.XML (default location is C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML) <Mapping Key="csv" Value="icxltx.png" OpenControl=""/> Then in IIS Manager select the server and then select MIME Types, update the entry for csv to 'application/vnd.ms-excel'. This will allow you to click the ...


3

Just a five minute pseudocode, this should work... add-pssnapin microsoft.sharepoint.powershell $SPWeb = get-spweb http://sharepoint/sites/sitecollection/subsite $owner = "domain\adminuser" $op = New-SPClaimsPrincipal $OwnerName -IdentityType WindowsSamAccountName $owner = $SPWeb | Get-SPUser $op $csvlocation = "c:\csv\users.csv" $values = Import-Csv $($...


3

It's a normal behavior based on your current server specifications. You can imagine updating 8000 items in one shot! also, looping to checks the corresponding item and to check if exists update it if not add it! it's a big headache!! In case you need to decrease PowerShell execution time, you have to do the following: Try to use a CSOM PowerShell with ...


2

You can also setup a basic SSRS report to list all the columns you want, then set a subscription on it to export it as a CSV file (to a doc library or network share) on a scheduled basis. Iterating by loop of any object as per your script will always get slower with the increasing volume of objects.


2

Perhaps consider processing it in batches, instead of trying to process all items: http://msdn.microsoft.com/en-us/library/office/ee557257%28v=office.14%29.aspx


2

Try to use Owner instead of owneralias, and SecondaryContact instead of secondaryowneralias.


2

There was a same question on stackexchange and answered.I hope this article helps you out. How to import term sets to Managed Metadata Service using PowerShell and CSV file Also the below TechNet article explains the CSV file format for metadata termset values. https://technet.microsoft.com/en-us/library/ee424396.aspx However if you have the well ...


2

I found a much simpler script that does the trick shown below: function Get-DocInventory([string]$siteUrl) { $site = New-Object Microsoft.SharePoint.SPSite $siteUrl $web = Get-SPWeb "http://contoso.com/sites/Depts/HTG" foreach ($list in $web.Lists) { foreach ($item in $list.Items) { foreach($version in $item.Versions){ $data = @{ ...


2

This may or may not solve your problem, but either way it's worth trying. Microsoft recently changed to modern document libraries, which may have changed the behavior of your csv-file. In your tenant admin site, go to settings > organization and turn off modern document libraries, which will switch back to "classic" document libraries. You can also, in the ...


2

The is no built in functionality that does this, if that's what you're asking. You could however write an event receiver that runs whenever the text file is updated in your document library, passes the contents, and then updates the SharePoint list. You could also use Business Connectivity Services to expose the contents of the text file through a ...


1

I had this same issue some days ago. Following code works for me to escape this problem. protected void Page_Load(object sender, EventArgs e) { string js = @"_spSuppressFormOnSubmitWrapper = true;"; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "js", js, true); }


1

It looks like you're using $item["Modified"] to get the modified date of the version - I think you need to use $version["Modified"] or else it will just continue to use the modified date of the current, latest version. Same for the rest of the fields. Hope this helps!


1

Thanks Eric Alexander as I have figured it out with some direction from you. I have found also that by changing this line: "Item Name" = $item.File.Name To: "Item Name" = $item.Name That it returns both list names and file names from Doc Libraries as well. I tried what you posted but some Item Names returned blank. Not sure of what the reason was.


1

If you only need the checked-out files, then I believe you should not loop over the list items in your code i.e. remove foreach($item in $items) which is present inside foreach($file in $files). Moreover, if you want to get the SPListItem associated with the SPFile, you can use SPListItem.File property for that.


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

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


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

Here is the script. It will get you primary administrators in an excel file for each site collection inside a web application. I am not able to get Secondary Owner Property though. $WebApplicationUrl = "https://peopletest.brookfield.com" $outputFile1 = "C:\TEMP\siteCollectionAdminsPrimary.csv" $outputFile2 = "C:\TEMP\siteCollectionAdminsSecondary.csv" $...


1

simple: Get-SpWebApplication http://www.contoso.com | Get-SPSite -Limit All | Select URL, ID, contentdatabase,Owner, SecondaryOwner | Export-CSV "f:\VLESites.csv" -NoTypeInformation


1

Try this $FilePath = "http://ServerName/sites/SiteName/MyDocumentLibrary/MyCSVFile.csv" $localPath = "C:\temp\test.csv" #Make sure temp folder exists $wc = New-Object System.Net.Webclient $wc.DownloadFile($FilePath, $localPath) $list = Import-Csv $localPath


1

Just to understand correctly, do you want to use the CSV file to provide metadata for the files that will be imported from the file share? If so, the approach depicted in the article (SPJeff) will not work. This sample uses a SP list as destination (as opposed to a SP library which is needed to support files). Look at this article in Code Project (http://...


1

In the lack of more details concerning the possibilities would work for you (e.g. looking at custom development or a no-code solution), i would the easiest is to use the BDC via SharePoint Designer to load from external source according to your schema. The major point here is what possibilities you have: could you bulk-export to some data store accessible by ...


1

Could you use the jQuery SP Services lib to save the values to a CSV file to a library in SharePoint and then direct them to that file? I've never used SP Services but I have heard great things about it.


1

Try SPListItem.File.Url to get the the relative url of the file. And SPWeb.Url to get the url of the web and combine them together. In your code use: "Path" = $web.Url + "/" + $_.File.Url The code may look something like this. Note: I have not tested it. But it will give you an idea how to go with your scenario: if((Get-PSSnapin "Microsoft.SharePoint....


1

I have done the same some months ago. See the following sample: $destination = "C:\\tools\\Folder" $webUrl = "<Url of the specific site>" $listUrl = "<Url of the specific list. This url is complete Url and NOT relative url>" ############################################################## $web = Get-SPWeb -Identity $webUrl $list = $web.GetList($...


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