Skip to main content


Showing posts from 2014

Project Server to Sharepoint Email sync program

Today I got a support case where alerts in SharePoint was not triggered, I quickly realized the problem was that the email address on the users was wrong in SharePoint and the admins only updated the emails in Project Server. Why the emails were not correct i do not know and did not look further into it.
To solve the difference between SharePoint and Project Server I created this small C# script/program which synchronize user emails from Project Server into SharePoint.
You will typically need a tool like this when you are creating your users manually in Project Server and the emails are synchronized from a inconsistent Active Directory.

The program can be found here:
Project Server -> SharePoint Emails sync
The code for the program/script is as follows:
static void Main(string[] args) { string pwa = ""; string webApp = ""; if (args.Length <= 0) { WriteLine("WRONG ARGS, PWA"); return; } pwa = args[0]; …

SharePoint Sites and Pages Powershell Warmup Script

Very nice little script i created to warmup all PWA pages and workspaces.
Simply replace the SiteURL and the SitePages with your own values and place the code in a file named "SharePointWarmup.ps1".
Run the script in Powershell or Task Scheduler.

$SiteURL = "http://intra/PWA/" $SitePages = "default.aspx", "projects.aspx", "ProjectBICenter/_layouts/15/xlviewer.aspx?id=/PWA/ProjectBICenter/Sample%20Reports/Projectum/DailyCommentsReport%20v7%20-%20PowerView.xlsx&Source=http%3A%2F%2Fintra%2FPWA%2FProjectBICenter%2FSample%2520Reports%2FForms%2FAllItems%2Easpx%3FRootFolder%3D%252FPWA%252FProjectBICenter%252FSample%2520Reports%252FProjectum%26FolderCTID%3D0x012000271EBEF22B819D4AA417BE3C68ADBA34%26View%3D%257B857402E5%252DF616%252D4DC2%252DA880%252D5CFC03D52EFA%257D", "Project%20Detail%20Pages/Project%20Information.aspx", "project%20detail%20pages/schedule.aspx", "project%20detail%20pages/sd…

Run powershell from CMD or Task Scheduler

If you want to run a Powershell script against SharePoint on a timely schedule the Windows Task Scheduler is fast an simple approach.

A simple example of this could be a SharePoint warm-up script which hits a number of sites on a regular schedule. However it is maybe not as straight forward to figure out the syntax for the Powershell command as you might think.
Run in CMD

The first step is to verify you can run the script from a command prompt. (you might want to start the command prompt as the account that is going to run the scheduled task).

1. Click start and type CMD, press enter.

2. Paste the following command and replace the script-path with the location of you own script.
    Powershell -file "C:\PathToFile\SharePointWarmupScript.ps1"

3. Press enter and see the script being executed successfully.
Create Task Schedule
The next step is to create the scheduled task.

1. Click start and type Task Scheduler, press enter.

2. Left click Task Scheduler and click Create Task.

PWA - Every Queuejob is failing (The value's length for key 'application name' exceeds it's limit of '128', ReportingResourceChangeMessageFailed, ProjectPublishFailure)

Today I came across a very strange problem. On a newly install server every queue job was failing. Project Create, Resource Change, Workflow submit, every reporting job and some project job was failing.
Problem: I started looking into the queue to find an explanation. Here I found several errors, but could not make any sense of them.
Resource Reporting Error:
Generelt•Reporting message processor failed:◦ReportingResourceChangeMessageFailed (24008) - The value's length for key 'application name' exceeds it's limit of '128'.. Detaljer: id='24008' name='ReportingResourceChangeMessageFailed' uid='3f02fa38-f574-e411-93fd-00155d007817' QueueMessageBody='Resource UID: 'dc548543-3352-454e-a86b-96d1a4bf63d2'. ChangeType='Alter'. ResourceChangeType='All'' Error='The value's length for key 'application name' exceeds it's limit of '128'.'. ◦ReportingResourceChangeMessageFailed (2400…

PowerShell results size unlimited/truncated - $FormatEnumerationLimit/Width

Ever experienced the problem where you run a Powershell command and you cannot see the whole result because the result is truncated.

Problem: If you for example run the Test-SPsite command you might see something like the following:

Site : SPSite Url=http://atlas/pwa Results : { SPSiteHealthResult Status=Passed RuleName="Conflicting Content Types" RuleId=befe203b-a8c0-48c2-b5f0-27c10f9e1622, SPSiteHealthResult Status=FailedWarning RuleName="Customized Files" RuleId=cd839b0d-9707-4950-8fac-f306cb920f6c, SPSiteHealthResult Status=Passed RuleName="Missing Galleries" RuleId=ee967197-ccbe-4c00-88e4-e6fab81145e1, SPSiteHealthResult Status=Passed RuleName="Missing Parent Content Types" RuleId=a9a6769f-7289-4b9f-ae7f-5db4b997d284, SPSiteHealthResult Status=FailedError RuleName="Missing Site Templates" RuleId=5258ccf5-e7d6-4df7-b8ae-12fcc0513ebd, …

SharePoint 2013 Keeps Prompting For Credentials (DisableLoopbackCheck - BackConnectionHostNames - Logon Failure 401.1 - Access Denied )

Problem:When you access a SharePoint site collection, it keeps on prompting for authentication and eventually give you an Access Denied error.

Reason:This is a feature that prevents access to a web application using a fully qualified domain name (FQDN) if an attempt to access it takes place from a machine that hosts that application. The end result is a 401.1 Access Denied from the web server and a logon failure in the event log.

Solution:There are 2 ways to solve this,(1) the correct way and (2) the fast and easy way.

1 - The correct way (test/production servers)
Specify the host names that needs to do loop back check in the registry – BackConnectionHostNames. This is the correct way and is more secure.
 - Open regedit.exe
 - Navigate toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
 - Create a new multi-string value and name it "BackConnectionHostNames"
 - Type the host name of site that are referencing on the local server 

SharePoint 2013 : Cannot connect to the targeted site.

On my Contoso environment I was trying to create a sandboxed solution. I have already configured my app domain and app management services. But when I tried to validate the site I got the following error message.

Cannot connect to the targeted site. This error can occur if the specified site is not hosted on the local system. SharePoint solutions work only with locally-installed versions of SharePoint Foundation or SharePoint Server. Remote development is supported only for apps for SharePoint 2013.
If you search around the internet you will find many people suggesting to change your host file from to the actual IP.

Solution However the solution, at least on a Contoso environment, is to type in the actual IP address in the host file.
(the IP is the special IP for Contoso, I have 2 network adapters)
And do not forget to clear/flush the DNS cache. Now the solution can be created and validates.

Visual Studio 2013 Update 4 Release Notes (SharePoint notes)

A new update to Visual Studio 2013 is out, and as always there are a lot of general improvements and some improvements targeted SharePoint/Project Server.

The most noticeable changes for SharePoint development (and SharePoint App development) is:
 - Better IntelliSense for JavaScript
 - JSON improvements (Loading and IntelliSense)
 - Better HTML IntelliSense
 - #Region support in HTML
 - Razor bugfix
 - XAML Designer bugfix (Silverlight)

(Download it from:

Complete release notes

Team Foundation ServerYou can create trend charts and aggregate data from work item queries. When a new work item chart is created, you can see three new chart types: Stacked Area, Area, and Line. You can move items in the backlog to the top position (Move to Top) or to any position you want to determine (Move to Position).You can enter the "full-screen mode" for all the pages in the Backlogs hub.You can search for an Area path in Web Access. You can use Pull …

MS Project VBA - Read Lookup Table/Custom Field

After Project Online and heavy use of the PWA-Schedule features in Project Server 2010/2013 I rarely get use for my VBA skills anymore.

However today I needed to update a lot of resources in Resource Center with a value from a lookuptable. Therefore I needed a way to loop through all the lookuptable/custom field values and use the value.

After a little digging I found a way to read out all the lookuptable values through VBA. And of cause I need to share this.

VBA to read all lookuptable values from the RBS lookuptable  Sub ReadRBSLookuptable() 'Created by Christian Holse Fanning Dim lookupTableName As String lookupTableName = "RBS" Dim rbsLT As LookupTable Dim ltValue As LookupTableEntry For i = 1 To Application.GlobalOutlineCodes.Count If Application.GlobalOutlineCodes(i).Name = Trim(lookupTableName) Then Set rbsLT = Application.GlobalOutlineCodes(i).LookupTable End If Next i If Not IsNull(rbsLT) And Not (rbsLT Is No…

Error occurred in deployment step 'Add Solution': Attempted to perform an unauthorized operation.

Received this error today when trying to create a SharePoint solution against a newly created site.

My first problem was the site was configured to use a port which was already used by another web site. Therefore the site could not start at all.

In my case both Default Web Site and SharePoint - 2000 was both using port 2000. Changing the port of Default Web Site and I was able to start the site.

However now I still received the same error message. When browsing the site I realized I did not have access to the site.

Giving access to my user and I was able to deploy the solution.

To sum up this post:
 - Check the site can start
 - Check the site can be browsed
 - Check your user have access to the site

Configure DMZ for SharePoint provider hosted apps (accessing web site from internet).

If you are developing apps provider hosted apps for SharePoint (or Project Server) and want to deploy them to SharePoint Online you need to host your app's web site part somewhere. One good and obvious place is to host it on Azure, however I have found that in order to troubleshoot your app it is a lot easier if the app is hosted on a local IIS.

In order to host your app on a local IIS you need to configure the DMZ for the app (in addition to the website, certificate, app secret and app id).

Configure DMZ for a D-Link router DMZ tells the router that you allow a specific port to go to a specific computer. In the following I will explain how to configure DMZ for my D-Link DI-524 router. Other routers will have similar approhes.

Log on to the router at IP address
Enter the admin user name and password (default password is "password").

Click on the Advanced tab.

 - Enable
 - Your PC's IP address (the PC hosting the apps web site)
 -  The port your s…

Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site

If you are starting to develop Apps for SharePoint or Project Server and you encounter the problem where you get the following error message:

Error 1 Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site. 0 0 SharePointApp_01

It is usually because the site you are developing against is not a SharePoint development site. The easiest way to solve the problem is of cause to create a new SharePoint Development site.

However this is not always possible and you might have a lot of content on your site you want to test against. Furthermore if you are creating a Project Server App I have not found a way to create a Project Server Development site.

Convert SharePoint (and Project Server) site into a Development site
This can simply be done through Powershell. To be able to run Powershell agains online you will need to download SharePoint Online Management Shell.

The Powershell script you need to run…

Install DLL in GAC - Windows 2008/2012 (Using Powershell, No GacUtil.exe)

If you want to install a DLL in the GAC and do not have the GACUtil.exe available. Powershell is properly the easiest way to procede.

Before Powershell you would properly just drag the DLL file into the C:\Windows\Assembly but this option is usually not available anymore.

Powershell - Add DLL to GAC So to install a DLL file in the GAC simply execute the below Powershell script. Remember you migth want to run the Powershell prompt as an administrator.
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")$publish=New-ObjectSystem.EnterpriseServices.Internal.Publish$publish.GacInstall("c:\temp\MyDllFile.dll")iisreset
The first line adds a reference to the assembly we need to be able to mange the GAC.
The second and third lines retrives the GAC object and publish a new DLL file to it.
The last line resets the Internet Information Services. This is only needed if your DLL file is used in a websi…

Project Server Read only Custom Fields (Javascript)

PROJECT SERVER - Make Custom Fields Read OnlyThe fields on the PDPs (Project Detail Pages) is always editable unless you make them read only in a workflow stage or use the calculated field as suggested in my other post. If you want to make a custom field read only without using aditional custom fields you have to do it through Javascript. In the following i will explain how we can make custom fields read only through Javascript.

Insert a Content Editor webpart to the PDP page where the field you have the field that should be made read only.

Select the webpart and from the ribbon select HTML->Edit HTML Source. Copy/Paste the following code into the Content Editor webpart.

function makeReadOnly() { var elements=document.body.getElementsByTagName("INPUT"); for (index=0; index < elements.length;++index) { if(elements[index].type=="text"…

Windows 10 Start Apps in Full Screen

Launch Windows 10 apps in in full screen mode If you recently have installed the Windows 10 Technical Preview on a tablet or computer system, you may have noticed that Windows Store apps run on the desktop now if you are using a system with mouse and keyboard.
I installed Windows 10 on my Surface pro one, but haven't seen any report saying the other models behave differently.
While it is still possible to enable the Start Screen interface, instead of using the Start Menu as you cannot use both it seems, apps that you run will run in Windows desktop mode by default.
That's not a big problem most of the time, but if you prefer to run some apps in full screen, Netflix or a game for example to get that extra bit of screen space this way, then you may have wondered how to make that happen.
There is no full screen option when you look at the window control icons in the top right corner of the screen. While you can use the controls to maximize the app window, it is still running in …

Ask me anything...

In the comments section below feel free to ask me any questions related to Microsoft Project Server, Project Server Programming (VBA/PSI/CSOM/Powershell), SharePoint or Project Portfolio Management in general.

Project Server Budget/Financial Management

Have you ever tried to do budget mangement in Project Server without UMT's financial mangement plugin (UMT 360). This can be a complex task as you do not want a very detailed plan of the financial usage, but rather just track the approved budget from the steering comittee.

UMT 360 can do a lot of cool stuff with your financial data. But if your company are not ready for the full rollout of this module and just want to track if the projects and departments are on track a more simple solution could be the answar.

This is where Projectum's app "Project Financials" come into the picture.

This app simply adds a new area to your project page (PDP) which allows you to save the budget for the Project.

This can then be summed up and catagorized in some nice reports.

Try it out!!

Powerpoint presentation viewer in SharePoint/Project Server

To have a Powerpoint presentation running on your SharePoint, Proejct Server or workspace site follow these simple steps.

 1. Copy the URL to the Powerpoint (located in a document lib in SharePoint)  2. Insert a content editor webpart.  3. In the HTML below, replace the file UID and the server name.   4. Insert the modified HTML into the webpart. URL: https://server/apps_products_and_concepts/_layouts/15/WopiFrame.aspx?sourcedoc=%7BF35655A3-7E70-41ED-A94C-75E9DBD24FF1%7D&file=Apps.pptx&action=default HTML: <iframe width="550" height="347" src="https://server/apps_products_and_concepts/_layouts/15/WopiFrame.aspx?sourcedoc={F35655A3-7E70-41ED-A94C-75E9DBD24FF1}&amp;action=embedview&amp;wdAr=1.7755102040816326&amp;Embed=1​" frameborder="0">This is an embedded &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;a target=&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;#39;_blank&amp;amp;amp;amp;amp;amp;amp;amp;a…