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; ...

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] . [...