Posts

Showing posts from September, 2011

SharePoint programmatically managing item permissions

Assigning SharePoint List Item level permission programmatically To add item level permission in an SharePoint List or Library, you need to keep three things in mind: You have a valid SPUser object in your hand You have to break the role assignment inheritance for the list You have to add Role Definition and Role Assignment to the targeted list item Though above statements looks complicated, don't think much about them – just use following two functions wisely and you are done :) Assumption: 1. You have SPListItem object in your hand 2. You have a valid SPUser in your hand Working: First call the below method and pass the SPListItem as the input parameter: RemoveAllPermissions Function private   static   void  RemoveAllPermissions( SPListItem  CurrentlistItem)         {              //The below function Breaks the role assignment inheritance for the list and gives the current list its own copy of the role assignments             CurrentlistItem.BreakRoleInhe

PeopleEditor Control Development

http://karinebosch.wordpress.com/sharepoint-controls/peopleeditor-control/

Cross Site Lookup and Parent Site Lookup

At many instances, we look for having a centralized master list that can be accessed across all SharePoint sites. We end up writing custom code to do that or in 2010, try and use the Enterprise Managed Metadata functionality. However, giving access for users to update this and also have them available as a picker in the Lists and Libraries is a challenge. CodePlex / Dev4Side have the Filtered Lookup which can be used to access a Master List in the parent site from subsites http://dev4side.com/projects/sharepoint-2010-filtered-lookup-field.aspx I tried this on my SP 2010 environment and it works fine, just ensure, you do an IISReset after Adding and Deploying this solution. One caveat though: if you try to customize a SharePoint list using InfoPath with this field in it, it is not going to work :)

Email as attachment - codeplex solution works

Image
SharePoint has "Email as a Link" for all document libraries, but not "Email as attachment". How handy would it be when you need to send a document that is present inside a Document Library to external people with just their e-mail id. Found a solution in CodePlex and it really works fine. It works for single selection as well as multi-selection http://sendemailsp2010.codeplex.com/ Steps: 1.        Add .WSP 2.        Deploy from Manage FARM Solutions 3.        Activate Site Collection Feature 4.        Then Add Site to Trusted Sites, in the Trusted Sites -> Custom Level, you need to enable the below setting Once you are done with this, you  will see your document library as below:

Updating hyperlink fields programmatically

Data in the Hyperlink Column can be populated / set in the following manners:   Item[“HyperLinkColumnName”] = “http://www.google.com, Google”; Item.Update();   Don’t forget space after comma.   Or   SPFieldUrlValue MyURL = new SPFieldUrlValue(); MyURL.Description = “Google”; MyURL.Url =  http://www.google.com ; Item[“HyperLinkColumnName”] =  MyURL;     Data from the Hyperlink Column can be get in the following manner:   SPFieldUrlValue MyURL = new SPFieldUrlValue(Item[“HyperLinkColumnName”].ToString());   string URLText = MyURL.Description; string URL = MyURL.Url;