Wednesday, September 30, 2009

Display the matching results in People Picker Control by clicking on check names link

You will find a function EntityEditorCallback(result,ctx,preventAutoPostBack) in core.js file. At the last line of the function, just call this function: onClickRw(true,false);

what ever you write in People Picker Control, It will display the matching results by clicking on Check Names link Or by pressing enter key.

No need to again click on that text and see the matching results.


-samarendra swain

Thursday, September 24, 2009

Delete a sharepoint group programmatically ?

To delete a sharepoint group using object model, below is the code snippet in c#.

// objSPWeb is SPWeb object
objSPWeb.SiteGroups.Remove(groupName);
objSPWeb.Update();

Update the List item permission programmatically

Suppose if you have already bind a sharepoint group to a list item in a custom list/library for integrating permission then later on , if you want to modify the permission for that list item, below is the code snippet to achive it.

SPRoleAssignment objRoleAssignment = objListItem.RoleAssignments.GetAssignmentByPrincipal(objSPGroup);
objRoleAssignment.RoleDefinitionBindings.Remove(web.RoleDefinitions["Full Control"]);
objRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions["Contribute"]);
objRoleAssignment.Update();

Samarendra Swain