Tuesday, October 1, 2013

Find exact wpw3 process to debug SharePoint application

Sometimes it's become really important to find exact wpw3.exe process to debug your SharePoint application. This will not effect other SharePoint application while debugging your application using Visual Studio.

Here, is the Steps:

1) Open Command Prompt (Run as Administrator, important)
2) Navigate to "C:\Windows\System32\inetsrv" folder
3) Execute "AppCmd list wp" command
4) Find your app pool id and match at the time of debug.



Sunday, September 29, 2013

Custom list template error

While developing a custom List Template, following error message can be displayed after deployment. "Unable to find default edit form for

This error typically display if you customize your list template using OOB SharePoint 'Save as List Template' option, and later use Schema.xml file in Visual Studio List Template project.

To Fix, search for '< Forms >' tag and add following xml, just before "< Views >" tag


<Forms>
      <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"></Form>
      <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"></Form>
      <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"></Form>
</Forms>





Error: unable to customize local term store

While linking existing column to a local Metadata term store. Following error generated.

To fix this issue, 
1) Select Managed Metadata service from Central Admin
2) Click on 'Properties' from ribbon
3) select "This service application is the default storage location for column specific term sets"
4) ok


Tuesday, February 26, 2013

Create cab files later convert it to WSP


In SharePoint when you create a Site Template and later need to modify some fields or elements, you first convert the Site Template WSP to a CAB file. Then extract the cab file and modify the content. 

Now, after making the changes you again need to re-pack. For this purpose 'CabPack' utility is handful.

This is specially important to fix "Document Information Panel" failed to load in office documents in a document library after site created using a custom site template. The fix to this problem is, check and assign proper "Source ID' for each column the library schema file.
Reference to this issue:
http://social.technet.microsoft.com/Forums/nl/sharepoint2010setup/thread/289b1499-f02d-4942-b047-6fd069d2eaf6

Cab Pack utility:

Send email with line break in body

Sending email using java script from SharePoint can be tricky sometimes. Using built-in SharePoint function 'escapeproperly' can be usefull here.

function SendEmail() 

{
  var data = "FIRST LINE" + "\n" + "SECOND LINE" + "\n" + "THIRD LINE";
  window.location = 'mailto:?body='+ escapeProperly(data);
}

</script>


Wednesday, December 5, 2012

Note board webpart is not working properly in pages

In Wiki Pages Note board webpart is not working, one reason may lack of permission. Following are the steps:

1)      Go to Central Administration->Application Management -> Under Service Application->Manage Service Applications
2)      Click on User Service Application.
3)      Click on Manage User Permissions under People
4)      Add “All Authenticated Users and NT Authority\Authenticated Users” and Check all the Check Boxes.


Basically, we need to give permissions to all users who want to use NoteBoard Webpart on the site.
 

Thursday, October 4, 2012

Error while customizing item added event receiver

Following error is generated at the time of updating an item in item added event receiver.

"System.Runtime.
InteropServices.COMException: 0x81020015The file PublishingImages/sample.jpg has been modified by..."

This type of issue will occur for following libraries:
  • Document library
  • Form library
  • Wiki page library
  • Picture Library
  • Reports library
  • Calendar list
 Following is the code to fix this issue:

public override void ItemAdded(SPItemEventProperties properties)
       {
           base.ItemAdded(properties);
           string strWebId = properties.Web.Url;
           string strListName = properties.List.Title;
           int intListId = properties.ListItemId;

           using (SPSite objSite = new SPSite(strWebId))
           {
               using (SPWeb objWeb = objSite.OpenWeb())
               {
                   EventFiringEnabled = false;
                   objWeb.AllowUnsafeUpdates = true;
                   SPList objList = objWeb.Lists.TryGetList(strListName);
                   SPListItem item = objList.GetItemById(intListId);
                   if (objList.ItemCount == 0)
                   {
                       item["Chapter"] = 1;
                   }
                   else
                   {
                       //Get max course value

                   }
                   item.SystemUpdate(false);
                   EventFiringEnabled = true;
                   objWeb.AllowUnsafeUpdates = false;
               }
           }
       }

Reference: http://sharepointconnoisseur.blogspot.in/2011/04/save-conflict-error-when-creating-list.html