Claus on Code

A data dudes random musings about code, bugs, products, life etc.

  • Impersonating administrator

    Developing to sharepoint 2003, you often need to access data, that only an administrator has access to. To do that in code, you need to impersonate an administrator. The classic solution looks like this.    Add the following code to your project:  private WindowsImpersonationContext ctx = null;  public void UseAppPoolIdentity(){   try{    if (!WindowsIdentity.GetCurrent().IsSystem){… Continue reading

  • Show webparts for all users

    To my big surprise, sharepoint users, who are only members of custom site groups, can’t see all webparts. This is apparently because the webpart gallery is stored in a list, and the list doesn’t inherit security for the portal. To enable all users to see all webparts, edit the webpart gallery list, so it inherits… Continue reading