SIGN UP MEMBER LOGIN:    
ARTICLE

How to enable Sync to SharePoint Workspace for SharePoint document libraries

Posted by Vijai Anand Articles | SharePoint August 20, 2011
In this article we will be seeing how to enable Sync to SharePoint Workspace button in the ribbon interface for SharePoint document libraries so that the documents can be synced to SharePoint Workspace and the users can work from offline.
Reader Level:

In this article we will be seeing how to enable Sync to SharePoint Workspace button in the ribbon interface for SharePoint document libraries so that the documents can be synced to SharePoint Workspace and the users can work from offline.

ShrDcLib1.gif

Enable Sync to SharePoint Workspace using UI:

  1. Go to Shared Documents=> Library Settings => General Settings => Advanced Settings.

    ShrDcLib2.gif
     
  2. Click Yes in Office Client Availability section.

    ShrDcLib3.gif
     
  3. Click on Ok.
  4. Sync to SharePoint Workspace option is enabled successfully.

    ShrDcLib4.gif

Enable Sync to SharePoint Workspace using SharePoint Object Model:

  1. Open Visual Studio 2010.
  2. Go to File => New => Project.
  3. Select Console Application template from the installed templates.
  4. Enter the Name and Click on Ok.
  5. Add the following Reference.

    Microsoft.SharePoint.dll

  6. Add the following Namespace.

    Using Microsoft.SharePoint;

  7. Replace Program.cs with the following code.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.SharePoint;
    using System.Text;

    namespace EnableSharePointWorkspace
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (SPSite site = new SPSite("https://servername:1111/sites/ContentTypeHub/"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {                   
                        SPList list = web.Lists.TryGetList("Shared Documents");
                        if (list !=null)
                        {
                            //Enable Sync to SharePoint Workspace
                            list.ExcludeFromOfflineClient =false;
                           //To Disable Sync to SharePoint Workspace => list.ExcludeFromOfflineClient = true;
                            list.Update();
                            Console.WriteLine("Sync to SharePoint Workspace is Enabled");
                        }
                        else
                        {
                            Console.WriteLine(list.Title + " does not exists in the site");
                        }
                        Console.ReadLine();
                    }
                }
            }
        }
    }

     

  8. Build the solution.
  9. Hit F5.

Enable Sync to SharePoint Workspace using Powershell:

  1. Go to Start => All Programs =>Microsoft SharePoint 2010 Products.
  2. Right click on SharePoint 2010 Management Shell and then click on Run as Administrator.
  3. Run the following script.

    $site = Get-SPSite "https://serverName:1111/sites/ContentTypeHub"
    $web = $site.OpenWeb()
    $list = $web.Lists.TryGetList("Shared Documents")
    if ($list -ne $null)
    {
    # Enable Sync to SharePoint Workspace
    $list.ExcludeFromOfflineClient = $false
    # To Disable Sync to SharePoint Workspace => $list.ExcludeFromOfflineClient = $true
    $list.Update()
    write-host " Sync to SharePoint Workspace is enabled"
    }
    else
    {
    write-host $list.Title "does not exists in the site"
    }

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor