I have some legacy piece of code in some old 5.3 templates which has been migrated to SDL Web 8. The offending piece of C# is as follows:
String publishItemsXML = publication.GetListPublishItems(uriTarget, false, false, TDSDefinesInterop.ListColumnFilter.XMLListDefault, listRowFilter);
This fails with the following errors
ERROR #1
User 'DOMAIN\MTSUser' is not authorized. Current user must have at least one of the following 'ReadOnly, ReadOnlyService, Administrator' Topology Manager role(s) to perform current action.
Component: Tridion.TopologyManager.Service
Errorcode: 0
User: NT AUTHORITY\NETWORK SERVICE
ERROR #2
Unable to resolve the items to be (un)published.
{
"error":{
"code":"","message":"Authorization has been denied for this request."
}
}
Error Code:
0x80040000 (-2147221504)
Call stack:
Microsoft.OData.Client.QueryResult.ExecuteQuery()
Microsoft.OData.Client.DataServiceRequest.Execute(DataServiceContext,QueryComponents)
Microsoft.OData.Client.DataServiceQuery`1.Execute()
Microsoft.OData.Client.DataServiceQuery`1.GetEnumerator()
System.Linq.Enumerable+WhereEnumerableIterator`1.MoveNext()
System.Collections.Generic.List`1..ctor(IEnumerable`1)
System.Linq.Enumerable.ToList(IEnumerable`1)
Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublicationIdToMappingsLookup(Session,IEnumerable`1,IList`1)
Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublishContextsPerSourcePublication(IEnumerable`1,IEnumerable`1,IEnumerable`1,Boolean)
Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublishContexts(IEnumerable`1,IEnumerable`1,IEnumerable`1,Boolean)
Tridion.ContentManager.BLFacade.Publishing.ResolveEngineFacade.GetListPublishItems(UserContext,String,String[],Boolean,Boolean,ListColumnFilter,String)
Publication.GetListPublishItems
Component: Kernel
Errorcode: 0
User: DOMAIN\MTSUser
ERROR #3
TemplateUtilities: Yes this caused the error:<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="80040000" Category="18" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0"><tcm:Line ErrorCode="80040000" Cause="false" MessageID="15734"><![CDATA[Unable to resolve the items to be (un)published.]]></tcm:Line><tcm:Line ErrorCode="80040000" Cause="true"><![CDATA[{
"error":{
"code":"","message":"Authorization has been denied for this request."
}
}]]></tcm:Line><tcm:Line ErrorCode="80040000" Cause="false"><![CDATA[An error occurred while processing this request.]]></tcm:Line><tcm:Details><tcm:CallStack><tcm:Location>Microsoft.OData.Client.QueryResult.ExecuteQuery()</tcm:Location><tcm:Location>Microsoft.OData.Client.DataServiceRequest.Execute(DataServiceContext,QueryComponents)</tcm:Location><tcm:Location>Microsoft.OData.Client.DataServiceRequest.Execute(DataServiceContext,QueryComponents)</tcm:Location><tcm:Location>Microsoft.OData.Client.DataServiceQuery`1.Execute()</tcm:Location><tcm:Location>Microsoft.OData.Client.DataServiceQuery`1.GetEnumerator()</tcm:Location><tcm:Location>System.Linq.Enumerable+WhereEnumerableIterator`1.MoveNext()</tcm:Location><tcm:Location>System.Collections.Generic.List`1..ctor(IEnumerable`1)</tcm:Location><tcm:Location>System.Linq.Enumerable.ToList(IEnumerable`1)</tcm:Location><tcm:Location>Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublicationIdToMappingsLookup(Session,IEnumerable`1,IList`1)</tcm:Location><tcm:Location>Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublishContextsPerSourcePublication(IEnumerable`1,IEnumerable`1,IEnumerable`1,Boolean)</tcm:Location><tcm:Location>Tridion.ContentManager.Publishing.Resolving.ResolveEngine.GetPublishContexts(IEnumerable`1,IEnumerable`1,IEnumerable`1,Boolean)</tcm:Location><tcm:Location>Tridion.ContentManager.BLFacade.Publishing.ResolveEngineFacade.GetListPublishItems(UserContext,String,String[],Boolean,Boolean,ListColumnFilter,String)</tcm:Location><tcm:Location>Publication.GetListPublishItems</tcm:Location></tcm:CallStack></tcm:Details></tcm:Error>
Component: Templating
Errorcode: 0
User: NT AUTHORITY\NETWORK SERVICE
The first of the 3 errors seems to be the key. Is there a way to make this work? Or is my legacy code (which uses interop) not going to work with the new topology manager code?