Tag Info

New answers tagged

0

I had the same issue, and in my case I had to use the CMSPUBLISHING#0 template because I was moving a subsite to a site collection. My solution was change the masterpage. Although seattle masterpage was chosen, I changed it to the oslo masterpage and worked fine, the 2013 layout experience came back. After I changed once more to seattle masterpage, and It ...


0

Try following code: $web = Get-SPWeb http://somesite $pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web) $pageLayout = $pWeb.GetAvailablePageLayouts() | Where { $_.Name -eq "BlankWebPartPage.aspx" } $page = $pWeb.GetPublishingPages().Add("spamDoc.aspx", $pageLayout)


1

I think it's whining about the spamdoc.aspx, instead try without the .aspx. Try this instead. $web = Get-SPWeb http://somesite $pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web) $pageLayout = $pWeb.GetAvailablePageLayouts() | Where { $_.Name -eq "BlankWebPartPage.aspx" } $folder = $web.GetFolder("SitePages") $page = ...


2

You should be able to impersonate the user, but will involve opening up a web object for each specific user. $user=$web.AllUsers.GetByID(28) $token = $user.UserToken; $impWebObj= New-Object Microsoft.SharePoint.SPSite($web.Url, $token); $imperWeb = $impWebObj.OpenWeb(); $list = $imperWeb.Lists["SPLISTNAME"] $fileage = 15 $query = New-Object ...


2

Term.GetTerms method will return all the terms under a given term. Here is the sample code from your example: $ggterm = $termset.GetTerms("GG",$true) foreach ($term in $ggterm) { $childTerms = $term.GetTerms(); foreach ($cterm in $childTerms) { Write-Host $cterm.Name } }


0

ChangeItem only contains subset of fields for the actual item that was changed. You need to get the actual item using, e.g., GetItemByUniqueId, and continue with that object. $myRealItem = $myList.GetItemByUniqueId($changeItem.UniqueId)


2

New-MsolUser -DisplayName "Caleb Sills" -FirstName Caleb ` -LastName Sills -UserPrincipalName calebs@contoso.onmicrosoft.com ` -Department Operations -UsageLocation US ` -LicenseAssignment contoso:ENTERPRISEPACK http://technet.microsoft.com/en-us/library/dn530773.aspx ...


0

Another option that I have found for restoring a site collection to a different domain to the source domain (and where the source site collection cannot be set up with the site collection admin for the destination domain) is to grant the user account doing the restore access to the web application. $w = get-spwebapplication http://[urltodestinationwebapp] ...


1

After a long day, it turned out that for successfully using the Powershell DownloadFile() method, in my environment (SP2013 with ADFS) following two lines did the trick(at least for me). $wc.UseDefaultCredentials = $true $wc.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f") So, the final code looks like, $FilePath = ...


1

Try this $wc = New-Object System.Net.WebClient $wc = New-Object System.Net.Networkcredential(Username, Password) $UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" $wc.Headers.Add([System.Net.HttpRequestHeader]::UserAgent, $UserAgent);


0

It might not be te most elegant solution, but this will get them into which ever group you put as $group. If your AD is on-prem follow this first. If they are already synced to your Azure AD, then just run the below code. function Connect-SPOSite() { param ( $admuser = "user@tenant.onmicrosoft.com", $admsite = ...


0

Using EnsureUser works http://msdn.microsoft.com/en-us/library/office/dn499819(v=office.15).aspx#bk_WebEnsureUser Just pass the GroupName and you can get the principalId of the group


1

I know it's been 3 years ago and already answered, but here you can find plenty of versioning scripts and ready programs: Disable a versioning on Image Libraries in SharePoint using PowerShell Enable versioning for all SharePoint Online lists using Powershell Enable versioning for all lists in SharePoint Online tenant (C#) Restore and clean up SharePoint ...


3

How to retrieve List Url in SharePoint Online using PowerShell CSOM Function Get-SPOCredentials([string]$UserName,[string]$Password) { $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force return New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword) } $context = New-Object ...


0

try this $MyWeb = WebUrl $MyList = MyWeb.Lists["ListName"] $MyItems = $MyList.Items $MyItems | Select Fields.. | Export-Csv FilePath $MyWeb.Dispose() Source: http://iwillsharemypoint.blogspot.com/2011/02/export-sharepoint-2010-list-to-excel.html Also Check this one ...


0

$sourceWebURL = "http://sharepointsite" $sourceListName = "mylist" function AddUserToSite ($web, $loginName, $permLevel) { $account = $web.SiteUsers[$loginName] $assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account) $role = $web.RoleDefinitions[$permLevel] $assignment.RoleDefinitionBindings.Add($role); ...


0

Get-SPWeb to aquire Sharepoint site .List['name_of_list'] on retrieved site to get list .Items on retrieved list to get elements | ForEach-Object to get single item data and create site with it.


0

First you need to read the list thorugh powershell. I assume you will run the script as a scheduled job/manually which will run with Farm admin privilages. Here is the code that will help you read the list items. Then in the For loop, you can create site using powershell with all the required parameters. Also, once a site is created, you can update the ...


0

this feature breaks the customized list form, more specifically the rich multi lines text boxes are not auto expanding. I ended up deleting all views and recreating them..


0

mmm try this script: $site = new-object Microsoft.SharePoint.SPSite("http://sitecollectionURL") $web = $site.rootweb $list = $web.Lists["Name of the List"] $caml='<Where> <Leq> <FieldRef Name="Created" /> <Value IncludeTimeValue="TRUE" Type="DateTime">2011-12-31T02:32:20Z</Value> ...


1

Try creating a script callAuditExport.ps1 that calls your current script file like this Start-Process powershell.exe -ArgumentList "-file C:\MyScript.ps1", "Arg1", "Arg2" This will cause a new Powershell process to run, then close when its done executing. It should free up the memory allocation when its done that way.


0

It was the silly one. The SMTP server i was using turned out to be wrong. Getting confused between many different environments i picked up the wrong SMTP server.


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


0

Have you tried Export-SPWeb and Import-SPWeb? We were trying to export and import a list with stsadm which failed, but Export/Import SPWeb worked fine. This worked for a list export/import: Export-SPWeb "https://sharepoint.portal.com/test" –ItemUrl "Lists/ApprovalTasks" –Path "C:\QuoteApprovalTasks.cmp" Import-SPWeb "https://sharepoint.portal.com/test" ...


0

I've analyzed the requests sent by your PowerShell snippet and an equivalent version sent by "native" managed client object modell by Fiddler. As far as I see, the difference is caused by the way PS handles (casts) objects in the background. I found, that this version does what you need: ofldurl= New-Object Microsoft.SharePoint.Client.FieldUrlValue $url = ...


0

This should work: $List = $Web.Lists[$listname] $item = $List.GetItemById($ID) $edrw = New-Object -TypeName Microsoft.Office.RecordsManagement.RecordsRepository.EcmDocumentRoutingWeb -ArgumentList $Web $ecm = $edrw.Router $FinalDestination = $ecm.GetFinalRoutingDestinationFolderUrl($item)


0

Go to List Settings of the list in concern. Go to Advanced Settings. Go to Quick Edit section. Click No radio button. Click Ok. Let us know if it helped you.


2

Use Datasheet-View and make Copy+Paste or this Powershell script: Add-PSSnapin Microsoft.Sharepoint.Powershell [System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site = new-object Microsoft.SharePoint.SPSite("SiteURL”) $web = Get-SPWeb -Identity siteURL $lista =$web.Lists["ListName"] $items = $lista.items foreach ($item in ...


1

after more digging, what I found is that, I had 2 different column in that list which has same GUID. there is a script on this link which helped me to found those fields. Then I removed them from my list. Luckily, those fields were not used, so all worked smoothly. I hope it helps others


0

Well, While it comes to audit SharePoint changes, I refer to this well described blog that helps me to view the audit log reports with all the changes :https://support.office.com/en-ie/article/View-audit-log-reports-b37c5869-1b47-4a82-a30d-ea20070fe527 But when it comes to get the auditing data in real time auditing, I prefer LepideAuditor for ...


1

There is no need to create an instance of Microsoft.Sharepoint.Client.ChangeCollection ClientContext.Load method is missing for loading the collection of Change objects Example $listTitle = "Tasks" $list = $context.Web.Lists.GetByTitle($listTitle) $qry = new-object Microsoft.Sharepoint.Client.ChangeQuery($true,$true) $changes = $list.GetChanges($qry) ...


0

If you want to create a Root Site Collection a the top level of your Web application you should not use the parameter: -HostHeaderWebApplication in the New-SPSite command. This site collection must have the same URL as the Web application. Currently, SharePoint prevents the creation of a host-named site collection with the same URL as a Web application. ...


0

The pipeline passes one object of a command to another. The result of the first command is an input for the next command. So in your example The first command Generated List of SPWebApplication which is passed to Get-SPSite etc http://technet.microsoft.com/en-us/library/ff607950%28v=office.15%29.aspx ...


0

I found the issue - I have to use the Internal Name for the Field Which in this case was the name1 $newDocumentSet.Folder.Properties["PortfolioLead1"]=$pN $newDocumentSet.Folder.Properties["ProjectLead1"]=$ppN $newDocumentSet.Folder.Update() $list.Update() $web.Update() Once i have included it this was it is now updating as originally required.


0

Try to create document set first and then user the resulting object to update the metadata. i.e. $newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,$Name,$cType.Id, $docsetProperties) // set properties // update item write-host "$name ... created" I have not tried to execute the powershell ...


2

Well the simplest and easiest solution would be to go to Computer > Add Network Location and copy-paste the address of the List (address can be found in the List's Settings). Reapeat for the other list as well. Now you have two folder shortcuts pointing to the contents of each list, on your SP Server. From then on it's simple cut and paste from one folder ...


2

Here is a script which copies documents across site collection http://blogs.msdn.com/b/rcormier/archive/2012/11/16/how-to-copy-sharepoint-documents-between-site-collections-using-powershell.aspx $ver = $host | select version if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"} if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0)) ...


1

You can do it using below script [System.reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) [System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, ...


0

Try "Here-Strings" Using Windows PowerShell “Here-Strings”


0

This is what we use. Under the task options for Action choose "Start a program". Program/Script: "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Add Arguments: -command "& 'C:\Pscripts\MyScript.ps1'" You could also try to log something in your script so that you can see if it is being run or failing etc. I use this function to Log ...



Top 50 recent answers are included