What are the Document Sets?
Its a Content type which groups documents with a single work item and wrap them into a single version or workflow.
To add a new custom button to the Manage tab of the Document sets ribbon,
To export document sets so that they can be downloaded as a single ZIP file.
1) Create the Empty SharePoint Project.
Add the reference of C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.Office.DocumentManagement.dll
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll
2) Create the Delegate Control with Site Scope Feature
i) Add the empty element in solution Right click ProjectAdd new Item Add empty element name as RibbonZipDelegateControl. And Delegate Control xml as shown in Image
ii) In Page load event write the logic to export Document Sets to zip file
iii) Add the Safe Control entry in web.config
SafeControl Assembly="DocsetRibbonDelegate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=492efe3bf2c2f2b0" Namespace="DocsetRibbonDelegate" TypeName="DocsetRibbonDelegate"
3) Create Web Scoped Feature for the Custom Action Which Raise DownloadZipDelegateEvent Event (In Manage Tab Of Document Sets)
i) Add the empty element in solution Right click ProjectAdd new Item Add empty elementname it as RibbonDelegateCustomAction. And Delegate Control xml as shown in Image
ii) Create Image Mapped folder to display Icon of Image and Provide its Path in Custom Action
using System;
using Microsoft. SharePoint;
using Microsoft.Office.DocumentManagement.DocumentSets;
using System.Web.UI.WebControls;
namespace DocsetRibbonDeleagate
{
public class DocsetRibbonDelegate : WebControl
{
const string EVENT_NAME = "DownloadZipDelegateEvent";
const string MIME_TYPE = "application/zip";
protected override void OnLoad(EventArgs e)
{
this.EnsureChildControls();
base.OnLoad(e);
if (this.Page.Request["__EVENTTARGET"] == EVENT_NAME)
{
SPListItem currentItem = SPContext.Current.ListItem;
DocumentSet currentDocset = DocumentSet.GetDocumentSet(currentItem.Folder);
this.Page.Response.ContentType = MIME_TYPE;
currentDocset.Export(this.Page.Response.OutputStream, 1024);
this.Page.Response.End();
}
}
}
}
4) Create Web Scoped Feature for the Custom Action Which Raise DownloadZipDelegateEvent Event (In Manage Tab Of Document Sets)
i) Add the empty element in solution Right click ProjectAdd new Item Add empty elementname it as RibbonDelegateCustomAction. And Delegate Control xml as shown in Image
ii) Create Image Mapped folder to display Icon of Image and Provide its Path in Custom Action
5) Enable the Document Set Content Type
i) Site Settings Site Collection FeatureEnable Document Sets Feature
ii) In any Document Library Setting Advance SettingsEnable Management of Content types.
iii) Add from existing Content TypesSelect Document Set Content Type
iv) In Document Library, Create new Document Set and Deploy the solution as stated in step 1 and3 Go to Managed tab Export document Set in zip file
msdn References
Its a Content type which groups documents with a single work item and wrap them into a single version or workflow.
To add a new custom button to the Manage tab of the Document sets ribbon,
To export document sets so that they can be downloaded as a single ZIP file.
1) Create the Empty SharePoint Project.
Add the reference of C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.Office.DocumentManagement.dll
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll
2) Create the Delegate Control with Site Scope Feature
i) Add the empty element in solution Right click ProjectAdd new Item Add empty element name as RibbonZipDelegateControl. And Delegate Control xml as shown in Image
ii) In Page load event write the logic to export Document Sets to zip file
iii) Add the Safe Control entry in web.config
SafeControl Assembly="DocsetRibbonDelegate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=492efe3bf2c2f2b0" Namespace="DocsetRibbonDelegate" TypeName="DocsetRibbonDelegate"
3) Create Web Scoped Feature for the Custom Action Which Raise DownloadZipDelegateEvent Event (In Manage Tab Of Document Sets)
i) Add the empty element in solution Right click ProjectAdd new Item Add empty elementname it as RibbonDelegateCustomAction. And Delegate Control xml as shown in Image
ii) Create Image Mapped folder to display Icon of Image and Provide its Path in Custom Action
using System;
using Microsoft. SharePoint;
using Microsoft.Office.DocumentManagement.DocumentSets;
using System.Web.UI.WebControls;
namespace DocsetRibbonDeleagate
{
public class DocsetRibbonDelegate : WebControl
{
const string EVENT_NAME = "DownloadZipDelegateEvent";
const string MIME_TYPE = "application/zip";
protected override void OnLoad(EventArgs e)
{
this.EnsureChildControls();
base.OnLoad(e);
if (this.Page.Request["__EVENTTARGET"] == EVENT_NAME)
{
SPListItem currentItem = SPContext.Current.ListItem;
DocumentSet currentDocset = DocumentSet.GetDocumentSet(currentItem.Folder);
this.Page.Response.ContentType = MIME_TYPE;
currentDocset.Export(this.Page.Response.OutputStream, 1024);
this.Page.Response.End();
}
}
}
}
4) Create Web Scoped Feature for the Custom Action Which Raise DownloadZipDelegateEvent Event (In Manage Tab Of Document Sets)
i) Add the empty element in solution Right click ProjectAdd new Item Add empty elementname it as RibbonDelegateCustomAction. And Delegate Control xml as shown in Image
ii) Create Image Mapped folder to display Icon of Image and Provide its Path in Custom Action
5) Enable the Document Set Content Type
i) Site Settings Site Collection FeatureEnable Document Sets Feature
ii) In any Document Library Setting Advance SettingsEnable Management of Content types.
iii) Add from existing Content TypesSelect Document Set Content Type
iv) In Document Library, Create new Document Set and Deploy the solution as stated in step 1 and3 Go to Managed tab Export document Set in zip file
msdn References
No comments:
Post a Comment