According to all of the articles I have read, including this one from Microsoft itself -- http://msdn.microsoft.com/en-us/library/office/ms520166(v=office.14).aspx, I should be able to access task form propeties using the ExtendedProperties property and the name of the field. For example, if my task has a field named ActionComment, I should be able to do something like

var comment = (reviewTaskAfterProperties.ExtendedProperties["ActionComment"] as string);

This, however, always returns null. Using the Visual Studio debugger, when I look at the ExtendedProperties property, every key is a Guid. What gives?

I know I can replace the above code with

var comment = (reviewTaskAfterProperties.ExtendedProperties[new Guid("5f4f18ad-7f5b-4d5d-879c-50b416acae3d")] as string);

but I would love to know if I am doing something wrong or not understanding the articles or something...


Looking at the code I wrote in the past, I used the field GUID for the index when accessing ExtendedProperties, even for custom fields.

//For example:
var ActionCommentFieldGUID = workflowProperties.TaskList.Fields["ActionComment"].Id;

var comment = (reviewTaskAfterProperties.ExtendedProperties[ActionCommentFieldGUID].ToString());

Thanks for the question, btw. I was updating my code and wanted to learn more about how the ExtendedProperties were populated. Your link to the article on ExtendedProperties helped me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.