Project Online: Create Projects Does Not Like Trailing Spaces

Project Online Error; Create Projects; Troubleshooting; Project 2013

Thank you Brian and Happy Holidays to all.

Always fun to find the root cause and a good way to unblock a customer, even if as in this case the customer was ‘”one of our own” in CSS using one of our (many) internal Project Online instances.  The problem here was with a feature that I am sure some of you may not have come across, which enables you to create a project from a list item in a custom list (not a Task list – just a basic custom list).  The idea here is that you have a list of potential projects in your custom list, and when you decide the time is right to make it a real project you just select it (or them) from the list and click in the Items Tab, and Create Projects!

image

Easy – except when it isn’t.  You may get the dreaded “Sorry, something went wrong” error, and a correlation ID – but as you can’t get at the logs there isn’t much to help you.  I do have access to the logs (as you would if you hit this on-premises – more later…) and I was suspicious of some white space between a project name and a full stop – plus of course the error “ProjectInvalidName”.

12/29/2014 11:08:29.54    :w3wp.exe (0x42A8)    0x4CFC    Project Server    General    8yi1    Medium    Error is: ProjectNameInvalid. Details: Attributes:  PlusSpaces     . Standard Information: PSI Entry Point:…..

The next problem is that if you just try again (either after removing the spaces, or just hoping it might work) then you get:

A project already exists for list item with title PlusSpaces . Please select a list item that is not already converted to a project.

image

What’s going on?  I had a dig around and from a previous question from one of our MVPs I had discovered that we add a field to the list item that we track to understand that a project was created – a GUID – MSPWAPROJUID.  I’d played around with this on-premises, but hadn’t needed to do this kind of thing in Project Online.  A quick search got me to a good sample of a PowerShell script from Craig Riter on StackOverflow – then just needed to home in on the properties I was interested in and reset then to empty.  I suspect other project creation failures may also leave the list item already tagged to a project, and my first work-around was just to copy and paste to a new list item – but cleaning with with PowerShell feels like a better solution.  In my on-premises environment I repro the failure to create the project – but I just needed to delete the spaces and it would then work fine.  It looks like we have changed the GUID stamping in one or the other environments.

Here is my PowerShell in case you find yourself having a similar issue – and thanks again to Craig,

#Load necessary module to connect to SPOService

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client”)

Out-Null[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client.Runtime”)

Out-Null

#Login Information for script
$User = “me@<sitename.onmicrosoft.com
$Pass = “MyPassword”

$WebUrl = .sharepoint.com/sites/PWA”>https://.sharepoint.com/sites/PWA

#Connect to SharePoint Online service
Write-Host “Logging into SharePoint online service.” -ForegroundColor Green

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
$Context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User, (ConvertTo-SecureString $Pass -AsPlainText -Force))

#Get the right list
Write-Host “Getting the required list.” -ForegroundColor Green
$List = $Context.Web.Lists.GetByTitle(“Project Intake”)

$Query = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery(100);
$Items = $List.GetItems($Query);

$Context.Load($Items);
$Context.ExecuteQuery();

#Edit existing list items
foreach($item in $Items){
$item[“Title”] $item[“MSPWAPROJUID”] If ($item[“Title”].Trim() -eq “PlusSpaces”)
{
$item[“MSPWAPROJUID”] = “”
$item[“MSPWAPROJPUBJOBID”] = “”
Write-Host “Removing PWA GUIDS for Id=$($item.Id).” -ForegroundColor Green
}
$item.Update()
$Context.ExecuteQuery();
}

Write-Host “Your changes have now been made.” -ForegroundColor Green

In this example I was just looking for my “PlusSpaces   “ project – and used the trim as the first time my “If” didn’t hit as I got the number of spaces wrong.  Duh…  I executed this from my on-premises environment and the SharePoint Management Shell so probably had all the right DLLs handy – if you are using just your normal PC and PowerShell you may need to load other stuff – but I’m sure there are blogs out there to point you in the right direction.

This sets me thinking that there is also an answer to the funny stuff that can happen with the hidden user information list and Project Online.  Anyone for a name change?

View article…


PPM Works is a full service Microsoft Project and Portfolio Management consultancy, focused on Microsoft Project Server and Microsoft SharePoint platforms.  We believe in partnering with our clients to exceed expectations and build long lasting rewarding partnerships. We are continuously building a knowledge base of multiple tips, tricks and solutions to make your use of Microsoft Project Pro as quick and easy as possible. Contact us for more information.

Stay updated with the latest of Project Online/Server 2013 with us: Subscribe. Check our future events!

Subscribe to our webcast email list for updates on our upcoming webinars! 

Visit our FAQ Page for access to our tool box.