Not really a support thing as such – but I had a question a while ago about the feature to save projects to task lists, and how they are kept in sync? And how can I get at the right task in the SharePoint list programmatically – as the IDs don’t seem to match? Nothing to do with the Project Server 2013 sync of tasks from the plan to the site task list – this is the feature that works from the Microsoft Project client to any SharePoint site – no need for Project Server. I didn’t know the answer, but I was keen to find out as I too had seen IDs showing in the SharePoint task list that didn’t appear to match the plan – yet they were still kept in sync. Of course I could have just gone and read the spec… But where is the fun in that?
I’m starting off with a simple plan:
And saving to a new site – BlogPost, where the tasks will be added to the “Tasks” List, which happens to be on my Project Online tenant – but could be just a SharePoint on-premises or Online site.
Here is my view in the new list on my new site – and I have added the ID column to my view, and also turned on versioning (which will help later to see what’s happening)
If I swap my tasks around in Project and save again – my task list gets updated too – all my IDs look as expected, with a useful message along the way so I can see what has happened:
Unique ID still equals ID – looking good! Now I’ll add a new task in my plan, and a new task in my list – then sync – and see what happens
Hmm – 2 tasks with ID of 4. What will save/sync in Project make of this?
In project I get a new ID of 5 for the task that had ID of 4 in the list.
But in SharePoint it also adds the task from Project and makes it ID 5 – and keeps its own task as 4.
What happens if I edit the ‘Project’ task 4 – by updating the task name for example?
So even though the ID in SharePoint no longer matches the one in Project – it did the right thing. How does it know?
This is where I take a look at versioning and other list settings, as it shows a few things that explain how this all works. From the List tab on the SharePoint task list we can go to List Settings, and if we scroll down we can also see the columns for this list.
The ones that jumped out at me were the highlighted ones, SyncedProjectGUID and TaskUID – but I didn’t see them in the list of columns that I could add to a view. I did however see them in the history when I looked at Version History for the Task that was added in SharePoint.
I can see that the TaskUID is 5 – which matches the UniqueI D in the project plan! So that explains how Project keeps track of the tasks – but how does it keep track of the project? I knew it must have some way to track this, as I had seen warning messages if you try to sync a different project to a site. I can see the SyncedProjectGUID here is B34FEFA5-34AE-E411-827D-00155D745A06 – but what exactly does that mean? It didn’t seem to match up to any other identifier I could see for the list – although I did manage to find it in the client side logging and also in a Fiddler trace. In case you are not familiar with it – Fiddler can sit between your browser/application and the web server and show what traffic is going back and forth (including passwords – so don’t share Fiddler traces without adequate security – and preferably never start a trace until after you have logged in!). This is just part of the payload of a call to lists.asmx:
<Field Type="Text" Name="SyncedProjectGUID" DisplayName="SyncedProjectGUID" Description="GUID of the Synced Project. Please don't modify or delete." AllowDeletion="FALSE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInNewForm="FALSE" ShowInViewForms="FALSE" ID="{7966fcc7-e870-4d22-8c5f-3e39710f743d}" Version="4" StaticName="SyncedProjectGUID" SourceID="{bfcb303b-79e2-46d3-9c4f-7e42592c9b66}" ColName="nvarchar5" RowOrdinal="0"><Default>{B34FEFA5-34AE-E411-827D-00155D745A06}</Default></Field>
Now those properties of the list item helped me understand why I wasn’t able to show this as a column on the task list. From the client side logs (and perhaps that should be a good topic for another day) I saw the log entry pertaining to this Fiddler traffic:
02/06/2015 14:07:11.24 WINPROJ.EXE (0x14ac) 0xe28 Project Client Wss ahmpf Verbose Entering Function=CWssList::UpdateList pwzNewFields = (null) pszUpdateFields = <Fields><Method ID="1"><Field Type="Text" Name="SyncedProjectGUID" DisplayName="SyncedProjectGUID" Description="GUID of the Synced Project. Please don't modify or delete." AllowDeletion="FALSE" ShowInDisplayForm="FALSE" ShowInEditForm="FALSE" ShowInNewForm="FALSE" ShowInViewForms="FALSE"> <Default>{B34FEFA5-34AE-E411-827D-00155D745A06}</Default></Field></Method></Fields> pszDeleteFields = (null) pszProperties = (null) 7C768CFF-AE4C-11E4-827D-00155D745A06
I’m imagining some of you are looking at that and thinking this looks like a ULS log – and the format is the same – which means you can read the client side logs in ULSViewer.
Part of the original question was how do I get at the task in the list programmatically – if I know the TaskUID/Unique ID from the project plan? I had a play around with OData calls to the list and found that it is easy to go to the ID of the item from the SharePoint list – just using the indexer – so for ID 4 in the list I can get to it with:
https://brismithteched2014.sharepoint.com/BlogPost/_api/web/lists/getbytitle('Tasks')/Items(4)...
But as the TaskUID is returned as a property when I viewed the output from that Url I knew that I should just be able to use a Filter on that property – and the following Url returned exactly the same item. Problem solved – partly.
https://brismithteched2014.sharepoint.com/BlogPost/_api/web/lists/getbytitle('Tasks')/Items?$f...
However, that still didn’t help me understand where this GUID was stored from the project end – it isn’t showing as a property anywhere that I could see. I then went to another trusty tool – DocFile Viewer - DFView.exe, which used to ship with Visual Studio, and allows you to see inside of various file that use OLE Doc format. I saved a copy of the mpp (called BlogPost-Tasks.mpp – the standard format of name that a task sync project gets saved as) from the Site Assets folder on my BlogPosts site using the “Download a copy” option (under the ellipses, under the ellipses) – then opened with DFView.
This shows the various data structures – and the one I looked in first (and got lucky) was the Props under 114.
There I scrolled down a bit and could see my projguid B34FEFA5-34AE-E411-827D-00155D745A06, as well as the list Url and other information such as the sync time. Very cool – well to me anyway. Not particularly useful – and not exposed as far as I can see – even to VBA – but it was good to finally understand how project and the task list kept tags on each other!
If you are interested in client side logging and can’t wait for me to blog it – then the session Adrian and I did at the Project Conference covers the configuration of 2013 Client logging - https://channel9.msdn.com/Events/Project/2014/PC209 - around about 37 minutes Adrian starts the Client Logging part, and moves on to 2013 logging at around 55 minutes. Worth watching to get an idea how the logging works. The slides that you can download from the same link contain the registry settings for 2010 and 2013.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.