Tuesday 24 November 2015

When you create a site in SharePoint using its "Save Site As Template" functionality, NO data in Web designer Galleries --> Composed Looks library.

Problem: 


When you create a site from Save Site As Template functionality either using Visual Studio to modify the wsp or directly creating a site from the Template. You don’t see any data in Web designer Galleries à Composed Looks library. Normally this library should have data similar to following:


Whereas you see similar to following when a site was created using "Save Site as template" WSP.




Reason: When you create a Site using the wsp that was created by "Save Site as Template" functionality, it changes a XsltListViewWebPart to ListViewWebPart in _layout\design\AllItems.aspx page.


Solution: To replace ListViewWebPart by XsltListViewWebPart.

Following picture is showing correct content of AllItems.aspx page (taken from a working site that displays correctly data in Web designer Galleriesà Composed Looks).



Whereas following pictures shows incorrect ListViewWebPart is placed in AllItems.aspx (taken from a non working site that displays no data in Web designer Galleriesà Composed Looks.)


To fix the issue please follow following steps:

Step 1: Open the WebSite that shows correct data in a SharePoint Designer instance. Navigate to All Filesà _catalogàdesignàAllItems.aspx page and open the file.

Step 2: Copy the section that has WebPartPages:XsltListViewWebPart  to a Notepad file lets name it Target.txt. We will use this to create our own WebPartPages:XsltListViewWebPart tag and will finally replace that to the AllItems.aspx page of the site that is not working.



Step 3: Now open our site that has problem, using SharePoint Designer. Navigate to All Filesà _catalogàdesignàAllItems.aspx Page and create a copy of this page so that if something goes wrong then you can always restore it.

Step 4. Checkout the AllItems.aspx page. Locate the WebPartPages:ListViewWebPart tag. Copy the whole tag to notepad file, lets name it Source.txt.

Step 5. We will use data (only some Guids) from Source.txt and will replace those Guids at correct places in Target.txt. Finally we will have our tag ready to be replaced in problematic AllItems.aspx file. Please refer following picture for data that has to be replaced in Target.txt from Source.txt.

Step 6. You will have to replace 1, 4, and 6 with View Name value from Source.txt.
Step 7: You will have to replace 2 with ListName from Source.txt.
Step 8: You will have to replace 3 with ListId from Source.txt.
Step 9: Finally your content in Target.txt are changed something similar to the following:
Step 10: Now replace the content of Target.txt into WebPartPages:ListViewWebPart tag in AllItems.aspx of the site that is not displaying Composed Looks data.
Step 11: Save and check in the file and try browsing content of Composed Looks and you should see your data.


Thursday 19 November 2015

Error occurred in deployment step 'Add Solution': The XSN cannot be used on the server.

This morning I had an issue while deploying an InfoPath 2013 form to a SharePoint Server using Visual Studio 2015 feature framework. The weird error message was as follows:

"Error occurred in deployment step 'Add Solution': The XSN cannot be used on the server."

After playing with InfoPath Designer's publishing options it turned out to be a very simple problem.

You have to publish the form to network location, with domain level security and Access Path should be blank. I have posted a few picture to explain where would you have an option to leave "Access Path" as Blank.