Blog on Project Server, SharePoint , PSI, VBA ,SQL & More…

Menu

Recently, on one of the customer places we have been asked to do an Integration with their resource system. while doing so I was in a need of updating the Resource Level Customfield. Very Innocently i took an Approach of updating the Resource using the CSOM. but behold i could not find any method which will do so :( then I logged a call with the microsoft support team and they have also come back saying that it is not possible, Forcibly i had to took the web services approach. And which took me to the unknown territory of authentication and authorization :(

So, Project Online does dual authentication which can be managed using the ClaimsHelper Class. but in our case client was using the Claim based authentication. so they used to have their own authentication page. and cause of that even ClaimsHelper class was not helping :(

Then i started working on storing cookies directly and passing them with the Web service’s CookieContainer. and then i was able to update the Resources.

First Let us refer to the Code shared by Microsoft on recording cookies and use the CSOM to fetch Web Title…

In the same solution Here, you will find the ReadCookies class which will read and then convert the same into the Cookie Collection using the following Code:

Now, same will be used to pass into the Resource.asmx to update the Resource level custom fields.

Note: How to get the cookies, Please use the the full solution where you found the ReadCookies Class. and debug the same to get the cookies as string which then can be pass into the above method which will be a cookie collections.

Those who are working with project server will definately like to go with the CSOM, as It reduces lot of development effort for a developer in terms of the retrieving the custom field values of the project,task and resources. with CSOM it is very easy to fetch the custom field information by using the simple API which is FieldValues.By simply using such API CSOM will return the custom field information.

Now, this works perfectly ok when we are trying to fetch the normal custom field values. but when we need to get the custom field information, which has the lookup table is not worry hard but i would say little tricky.

Remember when we had to get the custom field values which had the lookup in the Project server 2007/2010. We need to get the project level custom fields and loop through to get the MD_PROP_ID and MD_PROP_UID and other details which will find the custom field name and Guid. then find the lookup values and match with the code values and lot of other stuff.

Well, Here also we need to do few steps as mentioned below in order to fetch the information.

First get all of the custom fields from the O365 and Loop through the same to get the InternalName of the Custom field

This method will fetch the values from the Project Online for that lookup as we will only get the CODE_VALUE

Finally, made an Office App. Here are the Steps through which we can create an Office App and deploy the same.

App Development

STEP 1

STEP 2

Choose which app you want to create

STEP 3

By default, it will create 2 solutions,

Manifest files

Web application

At this point if you will hit the F5, automatically it will open Project Professional for you and under the Project TAB, you will be able to see the App which we have created just now.

But this is not enough, if you wish to deploy this App and Run this without the F5, you need to publish these apps to the network drive.

Deploy this app on the Shared Network drive

STEP 1

Right click on the OfficeAppWeb2 and Click on the Publish Button

In the package location you can write the folder name, where you want to deploy this package. And later this same package will act as your Web Application. Which will host your web application inside the IIS.

Note: Preferably it should be under the https, if you are using Azure for the same purpose. It will provide you the https

Now, Try to access the web Page from the browser first i.e. Home.html In case it gives you error while accessing the same. See to that you have Web Deploy 2.0,

And if still does not work then use,add and remove feature and see whether you have latest framework available or not (Generally this happens if you have installed .NET first and then Configured IIS)

Go to the control panel >> Add and Remove Feature and look under the Application Development feature.

STEP 2

Open the OfficeApp2 >> OfficeApp2Manifest >> OfficeApp2.xml

Now, Right click on the OfficeApp2 andyou will be prompted with the following screen:

Now, Click Finish and It will automatically open folder for you.

Copy the File from the OfficeAppManifests

And deploy the same inside some Network drive.

Add App Inside the Office 2013

Open the MSP

Go to the Project Options >> Trust Center >> Trust Center Settings

Select the Trusted App Catalogs

Once you click Ok, you need to restart the Project Professional 2013 again. Now we are all set to add an App inside the Project Professional

You will be able to see, Shared Folder Tab, Click and add the App

As you can see here, below is added app inside the Project Professional.

Hope this will help someone!! Feel free to leave comments in case it helps :)

Now, Read the Category of that GUID and add the Project inside the Project

CdS = sec.ReadCategory(CategoryUid);
// Get a new objects row to put the created project into
WbSvcSecurity.SecurityCategoriesDataSet.SecurityCategoryObjectsRow dsSecurityCategoryObjectsRow
= CdS.SecurityCategoryObjects.NewSecurityCategoryObjectsRow();
//Set the values
Guid SECURITY_CATEGORY_OBJECT_TYPE_PROJECT = new Guid("1771B1C0-6E26-4FB3-A480-C798AB506E82");
dsSecurityCategoryObjectsRow.WSEC_OBJ_TYPE_UID = SECURITY_CATEGORY_OBJECT_TYPE_PROJECT;
dsSecurityCategoryObjectsRow.WSEC_CAT_UID = CategoryUid;
dsSecurityCategoryObjectsRow.WSEC_OBJ_UID = new Guid("0e9a8ce3-2821-47c5-8ea4-ff602c499192");
// Add the row to the dataset and then pass to SetCategories to update
CdS.SecurityCategoryObjects.AddSecurityCategoryObjectsRow(dsSecurityCategoryObjectsRow);
sec.SetCategories(CdS);

Scenario: When a Project Manager Creates a project and wants to assign the project in certain category using the project server custom field, where custom field is the list of available Categories. By choosing the Customfield value. We can programatically assign project to a category.

It’s me again with the code of reading the Projects from the Project Online using the CSOM. Here refer to my earlier post of Create Project in Project Online using CSOM for more information of MsOnlineClaimsHelper class.