Wednesday 30 April 2008

Working with SharePoint Groups

This is a nice article that talks about working with SharePoint groups programmatically.

The only problem I had was I had to replace the lines
SPRoleDefinitionBindingCollection roleDefBindings = roleAssignment.RoleDefinitionBindings;

with SPRoleDefinition and added this role definition directly to the SPweb as shown below

SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)group);
def = web.RoleDefinitions["Full Control"];
roleAssignment.RoleDefinitionBindings.Add(def);
web.RoleAssignments.Add(roleAssignment);
web.Update();

http://www.emptycache.com/blog/2008/04/18/working-with-users-and-groups-in-sharepoint-2007/

Tuesday 22 April 2008

SharePoint Admin webservice

The Admin web service that SharePoint exposes _vti_adm/Admin.asmx can be used to create new SharePoint Sites, etc..the catch is you cannot just append this webservice url to any sharepoint site but only to the web app that hosts central admin..

For instance if you have a number of SharePoint sites at the following ports
1. http://servername:1233/CollaborationSite
2. http://servername:4545/TeamSite
3. http://servername:1066 - Central Admin

To connect to the Admin webservice you cannot do something like http://servername:1233/_vti_adm_Admin/asmx but you have to use the port that Central Admin is hosted so it will be http://servername:1066/_vti_adm/Admin.asmx

Tuesday 15 April 2008

Changing default text in Sharepoint

When you try to edit SharePoint pages like AccessDenied.aspx that sit in the Layouts folder in Sharepoints 12 folder hive you will notice that the text is not stored there.

They just reference resource files that sit under Inetpub under the location C:\Inetpub\wwwroot\wss\VirtualDirectories\portnumber\App_GlobalResources\wss.en-US.resx

So to change the Access Denied message to Access has been Denied or something like that you just need to change the value of the property accessDenied_pagetitle


Error: Access has been Denied