Posts

Showing posts from 2012

How to change value of Created By field or Modified By field?

You can change Created By column value or Modified By column value. To do this use below given code :             using (SPSite site = new SPSite(SPContext.Current.Web.Url))             {                 using (SPWeb web = site.OpenWeb())                 {                     SPList list = web.Lists.TryGetList("MyList");                     SPListItem item = list.GetItemById(1);                     web.AllowUnsafeUpdates = true;                     //You can use user id (integer)                      //item[SPBuiltInFieldId.Author] = SPContext.Current.Web.CurrentUser.ID;                     //You can use SPUser object also.                     item[SPBuiltInFieldId.Author] = SPContext.Current.Web.CurrentUser;                     item.Update();                     web.AllowUnsafeUpdates = false;                 }             }

How to find missing web part?

To find missing web parts in SharePoint we have many ways. Here I am going to show you 2 ways. With use of STSADM command :                stsadm.exe -o enumallwebs -includewebparts > c:\bkup\aa.txt                  This command will send the output in “C:\bkup\aa.txt:” file & where you can find “Status="Missing Type”. Basically this file will contain data in xml format & you will get information about the all sites you have with url & id. With use of SQL statement : a.        Use [WSS_Content] b.       SELECT SiteId , AllDocs . DirName as SiteUrl , AllDocs . LeafName as PageUrl , AllDocs . DirName + '/' + AllDocs . LeafName as Url , WebParts . tp_DisplayName as DisplayName FROM [dbo] . [AllDocs] INNER JOIN [dbo] . [WebParts] ON [AllDocs] . Id = [WebParts] . [tp_PageUrlID] WHERE [WebParts] . [tp_WebPartTypeId] = '8d6034c4-a416-e535-281a-6b714894e1aa' ORDER BY Url '8d6034c4-a416-e535-281a-6b714894e1aa

SharePoint Developer Interview Questions – Answers

Note: A LOT of these questions are specific to SharePoint 2007, and won't have applicability for SharePoint 2003! 1) What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from? There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2.0 WebPart base class. When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class: Cross page

SharePoint 2010 Interview Questions – IT Pro / Architect

Basic Intro SharePoint Architecture Questions 1) What are Web Applications in SharePoint? An IIS Web site created and used by SharePoint 2010. Saying an IIS virtual server is also an acceptable answer. 2) What is an application pool? A group of one or more URLs that are served by a particular worker process or set of worker processes. 3) Why are application pools important? They provide a way for multiple sites to run on the same server but still have their own worker processes and identity. 4) What are zones? Different logical paths (URLs meaning) of gaining access to the same SharePoint Web application. 5) What are Web Application Policies? Enables security policy for users at the Web application level, rather than at the site collection or site level. Importantly, they override all other security settings. 6) What is a site collection?  A site collection contains a top-level website and can contain one or more sub-sites web sites that have the same owner a