I'm trying to make an Office taskpane app, that can access a resources calendar exceptions, and display them to the user.
I managed to access the resources, I can get a lot of its fields, but not the calendar exceptions. It seems like, those are stored elsewhere, not in the Resource object, directly.
Some code snippets :
//First, I get the ID of a resource, that is clicked and store it in resourceGuid
function getSelectedResourceAsync() {
Office.context.document.getSelectedResourceAsync(function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
resourceGuid = asyncResult.value;
}
});
}
Then I use this ID, to get the selected resources fields, like Name, Cost, Work etc. and display them in a textfield on the HTML taskpane. Example :
function getResourceFields() {
text.value = "";
//I get the name of the resource here, and have it displayed in the textfield
Office.context.document.getResourceFieldAsync(resourceGuid, Office.ProjectResourceFields.Name,
function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
text.value = text.value + "Resource name: " + asyncResult.value.fieldValue + "\n";
}
}
);
//After this, I'm getting the ResourceCalendarGuid, which is a promising name for
//the resources calendar, but I'm stuck with it. I didn't find a way to
//actually access the resources calendar.
Office.context.document.getResourceFieldAsync(resourceGuid, Office.ProjectResourceFields.ResourceCalendarGUID,
function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
calendarGuid = asyncResult.value.fieldValue;
}
}
);
}
I would like to use this ResourceCalendarGUID to access the resources unique calendar, that has exceptions stored in it, and I would like to show these exceptions to the end-user, via the textfield on the html taskpane.
Thank you for your time!