Collaboration-2-Go


Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



Access Personal Views / Do something on behalf
Created: 04.01.2016
Categories: SharePoint Development; PowerShell

      Impersonate and access personal views of somebody else.

      Code:
      
      # enter valid values
      $url = "https://sharepoint.c2go.net/sites/test"
      $listName = "MyListName"
      $login = "MyLogin"

      $web = Get-SPWeb $url
      $userid = ($web.Allusers | where-object
        { $_.LoginName -eq $login }).ID
      $user = $web.AllUsers.GetByID($userid)
      $token = $user.UserToken;
      $impSite = New-Object Microsoft.SharePoint.SPSite
        ($web.Url, $token);
      $impWeb = $impSite.OpenWeb()
      $impList = $impWeb.Lists[$listName]
      $impList.Views
      

    

Send us a Comment!