Taking SharePoint lists, libraries or site offline, might be one of the features your customer will ask sooner or later. Normally you have the ECB menu, where you can find the “synchronize with SharePoint Workspace” Button. But maybe you want to create your own button or link or wrap some more logic to this functionality. In order to do so, i did some researching and came back with a solution, which i would like to share.
In order to achieve this, you’ll have to use a special ActiveXObject which is called Groove.SiteClientActiveX. I found two code snippets and tested them. First one to take offline a whole site and the second one to take a special list or library offline. You need the site url and optionally the list or library id. But look at the code and you will see how it works.
How to take a site offline:
[sourcecode language=”csharp”]
function syncSiteSPW(siteUrl) { var offlineClientScope_Site = 1; var offlineClientScope_ListOrLibrary = 2; var offlineClientScope_Folder = 3
var a = new ActiveXObject('Groove.SiteClientActiveX'); if(a.IsOfflineAllowed( offlineClientScope_Site, 100, 100, 1001)) a.TakeOffline( offlineClientScope_Site, 1, siteUrl, 1, 1, '', ''); else alert('Site cannot be taken offline.'); }
[/sourcecode]
How to take a list or library offline:
[sourcecode language=”csharp”]
function syncListSPW(siteUrl, listId) { var offlineClientScope_Site = 1; var offlineClientScope_ListOrLibrary = 2; var offlineClientScope_Folder = 3
var a = new ActiveXObject('Groove.SiteClientActiveX'); if(a.IsOfflineAllowed( offlineClientScope_ListOrLibrary, 100, 100, 100)) a.TakeOffline( offlineClientScope_ListOrLibrary, 1, siteUrl, 1, 1, listId, ''); else alert('List cannot be taken offline.'); }
[/sourcecode]
Just provide a link which calls one of the functions and it opens the SharePoint Workspace 2010.
..:: I LIKE SHAREPOINT ::..
Leave a Reply
You must be logged in to post a comment.