Posts

Add custom menu actions programmatically in SharePoint 2010

using ( SPSite site = new SPSite ( "http://moss.dev.com" )) {         using ( SPWeb web = site . OpenWeb ())         {             SPContentType contentType = web . ContentTypes [ "Curriculum Vitae" ];             SPUserCustomAction action = web . UserCustomActions . Add ();             action . RegistrationType = SPUserCustomActionRegistrationType . ContentType ;             action . RegistrationId = contentType . Id . ToString ();             action . Location = "EditControlBlock" ;             action . Sequence = 450 ;             action . Title = "Test" ;             action . Rights = SPBasePermissions . EditListItems ;             action . Url = "http://www.google.com" ;             action . Update ();         } }

Add favicon icon to site

Add favicon icon to site In SharePoint if you need to add favicon, you can do so easily by using SharePoint Out-of-box control SPShortcutIcon. The following code snippet shows how you can set the favicon: <SharePoint:SPShortcutIcon runat=”server” IconUrl=”YourIconUrl”/>

Steps to set Form based authentication (FBA) for SharePoint 2010

Image
1.        DOWNLOAD FBA User Management Tool           Go to “C:\Windows\Microsoft.NET\Framework\v2.0.50727”. 2.        Open file “aspnet_regsql.exe” (with Run as Administrator).                                 I.             You will get an installation form. Hit “Next” button.                               II.             Click on “Configure SQL Server for application services” then hit “Next” button.                             III.             Now provide server name to connect & install new database for Membership. Now hit “Next” button.                             IV.             Now you get a summary page on which you will get server name & its new database name called “aspnetdb”. Click on “Next” button.                               V.             Now database has been created. Click on “Finish” button. 3.        Install FBA tool. 4.        Create a new Site collection (suppose we called it “A”). 5.        Extend this site (Suppose we called it “B”).        

SharePoint Interview Questions and Answers

Q. What does AllowUnsafeUpdates do ? Ans. If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property. C#: ? 1 2 3 4 5 6 7 8 9 10 using(SPSite mySite = new SPSite("yourserver")) { using(SPWeb myWeb = mySite.OpenWeb()) { myWeb.AllowUnsafeUpdates = true; SPList interviewList = myWeb.Lists["listtoinsert"]; SPListItem newItem = interviewList.Items.Add(); newItem["interview"] = "interview"; newItem.Update(); } } Q What does RunWithElevatedPrivileges do? Ans. Assume that you have a Web Part in which you want to display information obtained through the Windows SharePoint Services object model, such as the name of the current site collection owner, usage statistics, or auditing information. These are examp