Tuesday, January 18, 2011

Save a custom view and reuse it in another document

Want to reuse existing view from one list/library and copy iy to other list/library.
Follow these steps:
Step 1: Create a new document library called Documents in site 1. Create new view called SourceView with all the columns in it.
Step 2: Create a new document library called Documents in site 2.
Step 3: Open Site 1 in SharePoint designer and navigate to Documents and open Forms folder. Here you will notice SourceView.aspx. Double click and open the page.
Step 4: Open Site 2 in another instance of SharePoint designer and navigate to Documents/Forms folder. Right click and create new aspx page. Name it MyView.aspx.
Step 5: Copy all the content from "SourceView.aspx" opened in step 3 paste it in "MyView.aspx" page.
Step 6: Now replace GUID of source Documents library with destination Documents library GUID.
To get GUID of Site 2 Document library, open Documents library and click Setting, Document library settings.
In the address bar, the URL will have the guid as the last part of the address.
Example:
http://Site2/_layouts/listedit.aspx?List=%7B35A23714%2D25E3%2D42A5%2DB4BA%2D868F31906FA2%7D
Guid would be the last part of the URL:
%7B35A23714%2D25E3%2D42A5%2DB4BA%2D868F31906FA2%7D
Modify the guid to be in the following format:
{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
You are alomost done.

You’ll see a popup informing you that “The URL `Documents/Forms/MyView.aspx’ is invalid.
A workaround for this error is to Save MyView.aspx again with different name in same Forms folder. Say we call it "NewView.aspx".

Step 7: Now open Site2 and navigate to Docuements library and click on views drop down and change the view to "NewView" Now you will see all the columns are automatically created.

I know this is a time consuming but this is one way to do it.

No comments:

Post a Comment