piomal
March 27, 2023, 11:32am
1
Hello,
I use Aspose.Tasks for Java, 22.9.
When I call getResources() for a project, I obtain a collection which contains one more Resource than visible in MSProject. This Resource:
has always index 0
has name "0 "
has some strange type (“bze$a” - likely obfuscated code) while the other collection elements have the proper type “Resource”
The API reference doesn’t mention any specialties for getResources().
What is the reason and how to fix it?
(deleting the 0-index element is a workaround but an ugly…)
Regards
Piotr
getResource_MSP.png (2.5 KB)
getResource_Debug.png (14.1 KB)
@piomal ,
could you check this answer:
@chamberlas ,
this behavior is not a bug. This is a “Root” or “Unassigned” resource.
In this way we mimic the MS Project behavior.
If you create an empty project and save it to XML using MS Project, you can observe a resource with Id = 0:
<Resources>
<Resource>
<UID>0</UID>
<GUID>A0CB8B7E-2A8C-436D-0000-0000000000FF</GUID>
<ID>0</ID>
<Type>1</Type>
<IsNull>0</IsNull>
...
Shortly put, it’s a service resource created by MS Project.
Currently you can use getIsRoot() flag to filter it out.
We will consider removing it from project.getResources() collection in a future release as there is no user scenario where the root resource can be used.
piomal
March 28, 2023, 12:58pm
3
Many thanks.
The hint with “isRoot()” allows mit to properly work with this collection.
1 Like