SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: May 2013

Great resource about SharePoint Databases

SharePoint DR

Interesting MS Learning Resource: The Virtual Academy!

Check out the MS virtual academy at www.MicrosoftVirtualAcademy.com

World Clock

Sometimes, you really need to see what time it is at any place in the world. This is our favy web site for doing this: http://www.timeanddate.com/worldclock/

Working with Connection Strings in Auto-Hosted Apps

Richard diZerega has a really nice util method for working with connection strings in Auto-Hosted Apps in SharePoint 2013. It goes like this:

using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Data.EntityClient;
using System.Linq;
using System.Web;
using System.Web.Configuration;

namespace MovemberWeb.Util
{
    public class ConnectionUtil
    {
        public static string GetEntityConnectionString(ClientContext clientContext)
        {
            //try to get the connection string from from the clientContext
            clientContext.Load(clientContext.Web, web => web.Title);
            ClientResult<string> result = AppInstance.RetrieveAppDatabaseConnectionString(clientContext);
            clientContext.ExecuteQuery();
            string connString = result.Value;

            //if the connection string is empty, then this is debug mode
            if (String.IsNullOrEmpty(connString))
                connString = WebConfigurationManager.ConnectionStrings[“LocalDBInstanceForDebugging”].ConnectionString;

            //build an Entity Framework connection string
            EntityConnectionStringBuilder connBuilder = new EntityConnectionStringBuilder();
            connBuilder.Provider = “System.Data.SqlClient”;
            connBuilder.ProviderConnectionString = connString;
            connBuilder.Metadata = “res://*/MovemberModel.csdl|res://*/MovemberModel.ssdl|res://*/MovemberModel.msl”;

            //return the formatted connection string
            return connBuilder.ConnectionString;
        }
    }
}

You can get it here: https://skydrive.live.com/?cid=743e7abd51ea3851&id=743E7ABD51EA3851%21757&authkey=!ACIqsQhqXZipXcY (Movember.zip)

Updates and alternative insights can be tracked here: http://social.technet.microsoft.com/wiki/contents/articles/16353.sharepoint-2013-best-practices-working-with-connection-strings-in-auto-hosted-sharepoint-apps.aspx

People Picker Quick Tip

Use Fiddler to monitor web traffic using the People Picker. This will provide insight in how to use the people picker for custom development. Keep track of updates to this tip and other debugging tips at http://social.technet.microsoft.com/wiki/contents/articles/12438.sharepoint-2013-best-practices.aspx#Debugging

TechNet Wiki SharePoint 2013 Best Practices Page

Setting up a dev environment for creating Windows 8 Apps that leverage SharePoint

Getting values of SharePoint Hyperlink and Person or Group columns

The next PS script shows how to do it:

$ProjectWeb = Get-SPWeb -Identity $ProjectWebName

foreach ($Item in $ProjectList.Items)
{
$SiteCollLink = New-Object Microsoft.Sharepoint.SPFieldUrlValue($Item[“SiteCollectionURL”])
$Url = $SiteCollLink.Url

$Owner = New-Object Microsoft.Sharepoint.SPFieldUserValue($ProjectWeb, $Item[“Owner”])
$OwnerName = $Owner.User.LoginName
$OwnerEmail = $Owner.User.Email
}

 

Please Note SiteCollectionURL is the name of a Hyperlink column, Owner is the name of a Person or Group column.

The Migration Dragon for SharePoint 2013

The Migration Dragon for SharePoint 2013 is a tool that we’ve built to help to migrate file and folder structures from the file system to SharePoint 2013 Document Libraries leveraging the batching mechanism of the SharePoint managed client object model. You can get it here: http://gallery.technet.microsoft.com/The-Migration-Dragon-for-c0880e59