FromTheField

Real world experiences of SharePoint PFE and CTS engineers from Microsoft UK

October, 2013

  • The Magically Disappearing "Destination Folder" Option

    I recently investigated an interesting issue for a customer. As you may know, when uploading a Document to a Document Library you are presented with the option to select which folder within the library to upload the document to, if the document library contains any folders.

    In the example below, you can see (highlighted) the option to select the destination folder, as the Document Library has a folder within - aptly named "Folder".

    The issue I ran into was that this option was not available for libraries within a specific Site (SPWeb) even if they contained a folder (see below).

    It turned out that somebody had changed the SPWeb property - "CustomUploadPage" to NULL. The custom upload page is called when a Document Library contains at least one folder. The fix for this was simply a matter of configuring this property to use it's default value:

    asnp *SharePoint* -ErrorAction SilentlyContinue
    $Web = Get-SPWeb "http://team.contoso.com/Sites/IT"
    $Web.CustomUploadPage = "/_layouts/15/UploadEx.aspx"
    $Web.Update()

    If you do run into this issue run the above script, replacing the highlighted URL with that of the affected Site (SPWeb).

    Brendan Griffin

     

     

  • Getting Started with Office 365 and the Client Side Object Model - CSOM

    SharePoint 2013 included some huge improvements to the Client Side Object Model, as more and more of the customers that I work with are moving to Office 365 I need to start thinking about updating the various scripts that I have to use CSOM. This is critical as my collection of scripts have been exclusively been written to make use of the Server Object Model - which I'm never, ever going to be able to access in Office 365 :)

    The beauty of CSOM is that the scripts can be run remotely, as long as you have sufficient permissions to the SharePoint site these can be run from your local machine!

    One of the pre-requisites of using the CSOM is the SharePoint 2013 client side assemblies which need to be installed on the machine that is running the script, these are included in the SharePoint Server 2013 Client Components SDK which can be downloaded from here - http://www.microsoft.com/en-us/download/details.aspx?id=35585.

    To get me started, I've written a super-basic script that connects to a Site within an Office 365 tenant and updates the Title and Description - that is all! As I become more proficient with CSOM, I will share my learning with the Blog. The script will prompt for the username and password, all you need to do is update the URL and the Title and Description (highlighted) to get this to work!

    #Add references to SharePoint client assemblies and authenticate to Office 365 site
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
    $Username = Read-Host -Prompt "Please enter your username"
    $Password = Read-Host -Prompt "Please enter your password" -AsSecureString
    $Site = "https://tenant.sharepoint.com/site"
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
    $Context.Credentials = $Creds

    #Connect to site within the tenant and update the title and description
    $Web = $Context.Web
    $Context.Load($Web)
    $Web.Title = "New Title"
    $Web.Description = "New Description"
    $Web.Update()
    $Context.ExecuteQuery()

     Brendan Griffin