SharePoint 2013: Timeout on ClientContext.ExecuteQuery

Ok, this one is a strange issue.

I have created a console app with Visual Studio 2013. Added the "App for SharePoint Web Toolkit" NuGet package to get the SharePoint.Client.dll
Then wrote just a few lines to test if it works:

        static void Main(string[] args)
        {
            ClientContext context = new ClientContext("https://sharepoint/sites/test1");
            var web = context.Web;
            context.Load(web);
            context.ExecuteQuery();
            Console.WriteLine("Title: " + web.Title);
        }

This is against an on premises installation with Kerberos authentication (NTLM and Basic are also enabled). On the line context.ExeucteQuery(); it just waits a long time and then gives me a timeout and 400 error.

The weird thing: If Fiddler is open during the execution, everything works as expected. No timeout, no error.

Solution

The solution is fairly simple:

Just attach a handler to the ExecutingWebRequest event and set the WebRequest.PreAuthenticate to true:

        static void Main(string[] args)
        {
            ClientContext context = new ClientContext("https://sharepoint/sites/test1");
            context.ExecutingWebRequest += context_ExecutingWebRequest;
            var web = context.Web;
            context.Load(web);
            context.ExecuteQuery();
            Console.WriteLine("Title: " + web.Title);
        }

        static void context_ExecutingWebRequest(object sender, WebRequestEventArgs e)
        {
            e.WebRequestExecutor.WebRequest.PreAuthenticate = true;
        }

SPSync v0.9 is now available

Ok, the last version is almost 9 month old, but now I finally had some time to look through all comments on uservoice and now proudly present the new version.

What's new?

The major change is: SPSync now supports Office 365 authentication which means, you can finally use SPSync with SharePoint Online and SkyDrive Pro. Just select "Office365" from the authentication list and enter your username (user@customdomain.com or user@customdomainpart.onmicrosoft.com) and your password. Domain is not required.

image

Also an issue with creating folders is now fixed and it doesn't matter anymore whether the title of a document library is not the same as the URL of the document library.

A reminder: The "Conflict Handling" is a setting just for conflicts. If you select "Overwrite local changes" it does not mean that a full sync is done. A conflict is if a file is modified locally and remotely. All other files are sync'ing independently from this setting.

Download the new version here: http://spsync.net and leave a comment or drop me a line at
support (at) spsync(dot) net

Windows Phone 8: StadtRAD Finder

Leider gibt es für das StadtRAD in Hamburg bisher nur iOS und Anroid Apps. Ich habe daher die Gelegenheit genutzt und eine Windows Phone 8 App gebaut. Sie zeigt den aktuellen Standort und alle Standorte der StadtRAD Stationen inkl. der Anzahl verfügbarer Fahrräder.

Einfach downloaden und testen:

258x67_WPS_Download_DE_cyan

stadtradfinderapp

Delete project from tfs.visualstudio.com

Just a short reminder for me, how to delete a project from tfs.visualstudio.com, because there is no UI to do that:

Open a Developer Command Prompt and type:

tfsdeleteproject /force /collection:https://xxx.visualstudio.com/DefaultCollection "YourProjectName"

Chocolatey: Package Manager für Windows

Aus Linux kennt man ggf. apt-get um Software/Tools zu installieren. Für Windows gibt es eine wirklich gute Alternative: https://chocolatey.org

Das ganze basiert auf http://nuget.org dem Microsoft .NET Package Manager. Es gibt bereits extrem viele Pakete und man kann problemlos eigene Pakete erstellen und hinzufügen.

Um Chocolatey zu installieren, einfach folgendes in die Kommandozeile eingeben:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

Zum Test habe ich direkt Proxy Switcher als Paket hinzugefügt. Um Proxy Switcher zu installieren muss nun einfach folgendes eingegeben werden:

image

SPSync v0.8

SPSync is now available in version 0.8. It has a bunch of bug fixes and a better tested sync engine.
Also it is tested on Windows 7 and Windows 8 against SharePoint 2010 and SharePoint 2013.

With Office 2013 you get SkyDrive Pro for free which is the Microsoft tool to sync a local folder with a SharePoint document library. However, this tool has some disadvantages:

  • Obviously, you need Office 2013. SkyDrive Pro cannot be downloaded independently.
  • You can define only one root folder, where all of your document libraries will show up. With SPSync you can sync any folder you like.
  • With SkyDrivePro you have no control what happens with conflicts. In SPSync you can define whether you would like to see a conflict dialog, always overwrite local changes or always overwrite remote changes.

SPSync now has a new installer and is no longer a "ClickOnce" application. It does not require administrator rights.

Download here: http://spsync.net

To provide feedback use support (at) spsync(dot)net or the FEEDBACK button on http://spsync.net

Sync SharePoint Document Libraries in Windows Explorer like Dropbox

A few weeks ago I started working on a new tool. All of you know Dropbox: It has nearly zero UI and just do what it is supposed to do.

I’m working a lot with SharePoint 2010 as it is my job and I also really like it. What I don’t like is how to work with document libraries that are mainly used as a file store. Of course, I know meta data and all these stuff what you can do with SharePoint, but sometimes you just want to synchronize a folder within Windows Explorer with a document library in SharePoint.

Microsoft already created a tool for that (or better: bought it from Groove ;-) It is now called SharePoint Workspace. It can sync document libraries and also custom lists. You then have an offline copy of an entire SharePoint site. BUT: It is somewhere “within SharePoint Workspace”. You cannot define a “normal” folder on your hard disk as the sync target.

That’s why I’ve created a new tool called SPSync which is intended to close the gap.

User Interface

The UI of SPSync mainly consists of an icon in your taskbar:

image

 


It has a context menu, where you can manage all sync configurations:

image

image

 

 

 

 

 

 

A configuration consists of a name, the local folder, the SharePoint site URL, the title of the document library, the conflict handling mode and the credentials to use. If the conflict handling mode is set to manual, a balloon will popup on any conflict and you can choose what you want to do.

That’s all for now what you can configure, but I will extend it in the next weeks/months.

Technical Details

First of all: The password is stored encrypted with the Windows Data Protection API and bound to the current user. Therefore it cannot be decrypted on any other machine or by any other user on the same machine.

The communication with SharePoint is done by the SharePoint Client Object Model (Client OM). The sync core is built from scratch and contains a meta data store to also be able to handle deleted files. SPSync checks for changes automatically every 30 minutes and also actively monitors the local folder for any changes. That means local changes are sync’d immediately to SharePoint.

Currently there are no overlay icons within the Windows Explorer (like you have it for the Dropbox folder), because those Explorer Shell Extensions require a native (C++) implementation.

How to get it?

Visit http://spsync.net to get more information.

Visual Studio Achievements

Viele kennen sicher diesen Blog Eintrag. Sehr lustig, und nun gibt es sie wirklich, die VS Achievements.

Dank Channel9 gibt es neben der Visual Studio Extension auch noch eine REST API und ein fertiges Widget. Meine Achievements seht ihr rechts in der Leiste. Einige sollten aber eher Minuspunkte geben... ;-)

Also ladet euch die Extension runter und sammelt fleißig Achievements.

Neues Jahr, neue Blog Engine - Roadmap für 2012

Ich möchte dieses Jahr wieder mehr zu meinen Projekten schreiben. Ich habe da einige gute Ideen.

Das erste Projekt auf der Liste: Mein etwas angestaubtes Blog, basierend auf dasBlog durch eine neuere Engine ersetzen. Das habe ich nun gemacht und wenn du das hier liest, funktioniert BlogEngine.NET wohl. Das letzte dasBlog Release ist von 2009, wobei auf Codeplex weiter fleißig auch am Source gearbeitet wird. Dennoch habe ich mich entschieden zu wechseln. Das einzige was ich bisher vermisse ist die OpenId Integration. BlogEngine.NET hat da leider noch nichts. Zumindest konnte ich nichts finden.

Außerdem habe ich bei der Gelegenheit das Application Request Routing (ARR) Modul für den IIS installiert, damit die meisten alten Blog Links auch weiterhin funktionieren. Dazu habe ich einfach ein paar Redirect Rules erstellt. Somit funktionieren die alten Artikel Links auch weiterhin.

Eine weitere Neuigkeit ist: Proxy Switcher hat nun auch eine eigene URL (http://proxyswitcher.net). Das Ziel ist dort auch bald nicht nur einen Redirect zu haben, sondern eine eigene Seite.