In this article we will be seeing how to change the Advanced Settings for Document library in SharePoint 2010 using PowerShell and c#. Go to Document Library => Library Settings => General Settings =>Advanced Settings. Using C#: using (SPSite site = new SPSite("http://serverName:1111/")) { using (SPWeb web = site.RootWeb) { SPList docLibrary=web.Lists["Doc Library"];
// Change the advanced settings
// Update the changes
docLibrary.Update(); } } Using PowerShell $site=Get-SPSite "http://serverName:1111/" $web=$site.RootWeb $docLibrary =$web.Lists["Doc Library"] # Change the advanced settings $docLibrary.Update() Content Types: C#: docLibrary.ContentTypesEnabled = false; PowerShell: $docLibrary.ContentTypesEnabled = $false Opening Documents in the Browser: C#: // Open in the client application docLibrary.DefaultItemOpen = DefaultItemOpen.PreferClient;
// Open in the browser docLibrary.DefaultItemOpen = DefaultItemOpen.Browser;
// Use the server default docLibrary.DefaultItemOpenUseListSetting = false; PowerShell: #Open in the client application $docLibrary.DefaultItemOpen = "PreferClient" #Open in the browser $docLibrary.DefaultItemOpen = "Browser" #Use the server default $docLibrary.DefaultItemOpenUseListSetting = $false Custom Send To Destination: C#: docLibrary.SendToLocationName = "Shared Documents"; docLibrary.SendToLocationUrl = "http://serverName:1111/Shared%20Documents/"; PowerShell: $docLibrary.SendToLocationName = "Shared Documents"; $docLibrary.SendToLocationUrl = "http://serverName:1111/Shared%20Documents/"; Folders: C#: docLibrary.EnableFolderCreation = false; PowerShell: $docLibrary.EnableFolderCreation = $false Search: C#: docLibrary.NoCrawl = true; PowerShell: $docLibrary.NoCrawl = $true Offline Client Availability: C#: docLibrary.ExcludeFromOfflineClient = true; PowerShell: $docLibrary.ExcludeFromOfflineClient = $true Site Assets Library: C#: docLibrary.IsSiteAssetsLibrary = false; PowerShell: $docLibrary.IsSiteAssetsLibrary = $false Datasheet: C#: docLibrary.DisableGridEditing = true; PowerShell: $docLibrary.DisableGridEditing = $true Dialogs: C#: docLibrary.NavigateForFormsPages = true; PowerShell: $docLibrary.NavigateForFormsPages = $true
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: