SharePoint 2013 | AMS–App Model Samples

Microsoft has just released a good set of examples of Apps on CodePlex. Most will work on Office 365 as well as on-Prem Sharepoint Server 2013.

Currently this project is very focused on the SharePoint scenarios but they say they are also keeping an eye on including the all-up Office Developer moving forward.  These volunteers are working with the MSDN Content Publishing team to take the most impactful and useful samples that complete common customer scenarios and publishing them as "Solution Packs" of content as well as "Sample Packs" of sample code.

Extremely useful for those of us “SharePoint Chefs” who take various code recipes and add our own flavor to them.

You can get additional details from the introduction presentation.

Quick list of included scenarios

  • Cloud based site collection provisioning
  • Creating site collections remotely using SP Apps in on-premises
  • Provision and integrate Yammer group into site provisioning
  • Manage and update theme settings in host web
  • Changing host web rendering with custom CSS
  • Site policy management with CSOM
  • Wiki page manipulation using CSOM
  • Site collection enumeration
  • Setting up Apps to Windows Azure with specific roles
  • People picker implementation for provider hosted app
  • Taxonomy picker implementation for provider hosted app
  • Utilization of JavaScript injection pattern to modify the UI for end users
  • Uploading of large files to SharePoint
  • Deploy branding to personal SkyDrive Pro sites automatically
  • Connect to and manipulate Office365 sites using console application
  • Provide custom template pattern for sub site creation
  • Manipulation of user profile properties remotely
  • Build sync of user profile properties in cloud
  • Taxonomy driven navigation control using JavaScript
  • Mass deployment of branding elements from console app
  • Hybrid self-service site collection provisioning – one UI for cloud and on-prem
  • Synchronization of user profile pictures from on-prem to SharePoint Online
  • Dynamic permission handling
  • Remote event receivers from host web

MSDN references

Check the new SharePoint Online Solution Pack for branding and provisioning. This package contains some examples, which originate from the AMS reference implementations. Here are the direct links for the Solution Pack

You can find an introduction to the SharePoint Online Solution Pack for branding and provisioning by following the blog post – Introduction to SharePoint Online Solution Pack for branding and provisioning released.

Microsoft OneDrive Goes Live

Microsoft is rebranding their SkyDrive service as “OneDrive”.

Not just a rebranding though, several new capabilities, including automatic camera backup for Android and the ability to share and view videos just as easily as photos.  In addition, customers who refer friends can now receive up to 5 GB (in 500 MB increments) for each friend who accepts an invitation to OneDrive, plus 3 GB just for using the camera backup feature.

According to the site:

We’ve built OneDrive into the latest versions of Windows, Windows Phone, Office, and Xbox. You can even make OneDrive your default storage option, so you never have to worry about whether you are saving files to the cloud: They are just there. If you happen to carry an iPhone or Android phone, or use an iPad, Android tablet, Windows device, or a Mac—OneDrive is available there, too.

So, here’s the invite link:

I really like the idea, hopefully they can pull it off.

SharePoint 2013 | Unexpected error occurred in method ‘GetObject’ , usage ‘SPViewStateCache’

Sometimes working on a DEV server runs into some unexpected features.  Like bad performance.  Sometimes the bad performance leads to bonus features in the error logs.

This one started popping up in the ULS viewer:

Unexpected error occurred in method ‘GetObject’ , usage ‘SPViewStateCache’ – Exception ‘Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0018>:SubStatus<ES0001>:The request timed out..

However, it’s a simple enough fix, just increase the timeout for the cache.  Not something you want to do in a production environment, but when you’re running on a DEV machine and you just need the SharePoint 2013 platform to run without errors so it’s not masking any actual issues, this seems to work pretty well.

$LogonTokenCache = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
$LogonTokenCache.RequestTimeout = 300 
Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache -DistributedCacheClientSettings $LogonTokenCache
$ViewStateCache = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
$ViewStateCache.RequestTimeout = 300 
Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache -DistributedCacheClientSettings $ViewStateCache

This will usually get rid of the error from popping up in the ULS logs.

SharePoint 2010 | Event ID 1511 – Windows Cannot Find The Local Profile for Application Service Account

During a review of the SharePoint farm health, I was seeing a lot of these errors in the event logs. The farm itself was still functional, but these errors were filling the event logs. The account is question was the same one that was used for the IIS website application pools. And while seemingly innocuous, it always bugs me to see these error events in the logs.  And as always with SharePoint and how MSCryptic the error handling is, there is always the possibility that things were not quite working right somewhere under the covers.

If you look in your event logs, you should see something similar to the following:

Log Name: Application
Source: Microsoft-Windows-User Profiles Service
Date: 11/19/2013 10:05:07 AM
Event ID: 1511
Task Category: None
Level: Error
Windows cannot find the local profile and is logging you on with a temporary profile. Changes you make to this profile will be lost when you log off.


For some reason, my User Profiles on the Windows Server 2008 R2 is experiencing issues where the accounts cannot create local profiles but creates a Temporary user profile for the account used for the SharePoint website application pool.


While investigating the issue further, I also found that if I actually tried to log into the server using the service account ID I ended up locking up the server with a “Please wait for User Profile Service” message that was displayed indefinitely (Don’t try it unless you have someone around who can give the server a one-finger salute to perform a hard reboot). Research on the internet seemed to point to IP6 issues, but after trying all the suggested fixes I was still experiencing these issues.

Instead, this approach seemed to work well for me. The user profile now comes up as local in the User Profiles settings and the error have gone away for the time being.

If you are experiencing the problem:

1. Open Services, stop and then disable IIS Admin Service so that the application pools do not lock the profiles.


2. Open the Server Manager, Web Server, and right click on the Server. Select Stop.


3. Now open a command window (Start-Run-> type “CMD” ) and in the window type the following:

net localgroup administrators DOMAIN\AppPoolAccount /add

runas /u:DOMAIN\AppPoolAccount /profile cmd

4. After the second command, you will be prompted to enter the password of the DOMAIN\AppPoolAccount and when you hit enter it will launch a new window. In the window type the following to confirm the user profile directory

echo %userprofile%

5. Launch the User Profiles dialog or check “C:\users” to verify that the directory for your application pool account ID has been created.


6. Close the second command window, and in the original one type the following to remove the app pool account from the administrators group.  For whatever reason it only needed to be there to create the local profile and it’s not best practices or recommended that you leave the account as an admin on a production farm.

net localgroup administrators DOMAIN\AppPoolAccount /delete

7. Exit the command window

8. Start the Web Server

9. Enable and then Start the IIS Admin Service.

If everything has gone well, you now have one less Error event showing up in your server’s event logs.  I did not need to perform a server reboot to get rid of the error, but mileage may vary depending on your own farm’s configuration and what else you may be using these service accounts for.