Author Posts

February 9, 2016 at 3:56 am

All,
I have written powershell script to connect to Microsoft Project server 2010 via web service call.
I was able to get the list of the projects with all information. There is a method called ReadProjectEntities which takes 3 parameters(Guid, Task_Resource_Types, DataStoreEnum) to read project tasks and hours. I have written the code as below

$pwaUrl = “https:///”
$pwaPSUrl_Projectasmx = "/_vti_bin/PSI/Project.asmx?wsdl"
$svcPSUrl = $pwaUrl + $pwaPSUrl_Projectasmx
$pwaPROJECT_ENTITY_TYPE_TASK_AND_RESOURCE = $pwaPROJECT_ENTITY_TYPE_TASK -or $pwaPROJECT_ENTITY_TYPE_RESOURCE

$myCred = Get-Credential

$svcPSProxy = New-WebServiceProxy -uri $svcPSUrl -credential $myCred
echo "proxy created"

[System.Enum]$pwaDataStoreEnum = $svcPSProxy.DataStoreEnum # this not returning as enum.
echo "Enum " $pwaDataStoreEnum.GetType() // this gives error.

#equivalent method in ASPX page with C# code is below

MyProjectWebReference.ProjectDataSet readProjDs = projectSvc.ReadProjectEntities(guid, PROJECT_ENTITY_TYPE_TASK_AND_RESOURCE, MyProjectWebReference.DataStoreEnum.WorkingStore);

I even tried to Load Office.Project.Server.Library dll and use DataStoreEnum but that too failed. Anyone have thought about it or any suggestions?

MSDN says DataStoreEnum is used from WebSvcProject but this wasn't easy in powershell. COuld be a simple thing but I have submitted this question in multiple forums but could not get any answer.

Thanks
Guhan