About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



Use the SystemAccount Property When Building SPUserToken Objects

I saw a developer doing this with some funky impersonation today, so I thought I would throw out some sample code. Consider the below shell code, demonstrating the SPSite.SystemAccount property use, subsequently using it to expose the SystemAccount.Token property to pass into the SPSite constructor.

C#:
  1. SPWeb primaryWeb = SPContext.Current.Web;
  2. using (var primarySite = new SPSite(primaryWeb.Site.ID))
  3. {
  4. SPUserToken userToken = primarySite.SystemAccount.UserToken;
  5. using (var secondarySite = new SPSite(primarySite.ID,userToken))
  6. {
  7. using (SPWeb secondaryWeb =secondarySite.OpenWeb(primaryWeb.ID))
  8. {
  9.  
  10. try
  11. {
  12.  
  13. }
  14. catch (Exception)
  15. {
  16. }
  17.  
  18. }
  19. }
  20. }

  • Share/Bookmark

1 Comment »

  1. [...] Use the SystemAccount Property When Building SPUserToken Objects [...]

    Pingback by Links (10/18/2009) « Steve Pietrek – Everything SharePoint — October 18, 2009 @ 5:31 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment