Last active
February 27, 2020 19:15
-
-
Save vaderj/52c77f27ddc257f107d1 to your computer and use it in GitHub Desktop.
#PowerShell #SharePoint #SSOM Instanciate SPSite object using a user token.From: http://w3foverflow.com/question/access-personal-views-in-a-list-with-powershell/This method allows for access to a users "Personal Views"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create a standard SPWeb object with admin credentials | |
$spweb = get-spweb http://url | |
#grab the user you want to instanciate under | |
$usr = $spweb.allusers | ? {$_.displayname -like "User Name"} | |
#make the user token accessable | |
$token = $usr.UserToken | |
#create a new SPSite obj using user token | |
$spsite = New-Object Microsoft.SharePoint.SPSite($spweb.url, $token) | |
#open the SPWeb with the root-relative path | |
$web = $spsite.OpenWeb("/sites") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment