Hi Paul,
The code that iterates through the Content Types collection of the Task List
should only set the variable contentTypeAssociated to true, if it finds a
content type with an identical name ... So I'm hoping that's not the issue,
but that does rely upon the Content Type Name being suitably unique,
assuming any earlier versions of the content type have already been
dissociated from the task list ... The line that appears to be causing me
grief is:
SPContentType newContentType =
workflowProperties.Site.RootWeb.ContentTypes[newContentTypeId];
It's almost as if despite the fact I've deployed the revised version of the
content type to the Site Collection, this expression is in fact retrieving
the previous version for some reason?
Cheers,
Trevor
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Paul Noone
Sent: Monday, 4 August 2008 3:19 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: Associating Content Type with Task List
Could it be that you've set the boolean contentTypeAssociated = true before
your final if (!contentTypeAssociated) statement?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Trevor Andrew
Sent: Monday, 4 August 2008 2:54 PM
To: listserver@ozMOSS.com
Subject: [OzMOSS] RE: Associating Content Type with Task List
Hi All,
I'm having some difficulties getting newly released and newly revised
versions of existing content types associated with a task list correctly.
The code I'm currently using, which is running in the context of a workflow
which is responsible for creating these custom tasks, is below:
if (!this.workflowProperties.TaskList.ContentTypesEnabled)
{
this.workflowProperties.TaskList.ContentTypesEnabled =
true;
}
SPContentTypeId newContentTypeId = new
SPContentTypeId(contentTypeIDString);
SPContentType newContentType =
workflowProperties.Site.RootWeb.ContentTypes[newContentTypeId];
bool contentTypeAssociated = false;
foreach (SPContentType contentType in
workflowProperties.TaskList.ContentTypes)
{
if (contentType.Name ==
awaitingResponseReviewTaskContentType.Name)
{
contentTypeAssociated = true;
break;
}
}
if (!contentTypeAssociated)
{
workflowProperties.TaskList.ContentTypes.Add(newContentType);
}
The steps I follow are below:
. Delete all tasks from the task list
. Dissociate the custom task content type from the task list
. Delete all site columns associated with the custom task content
types on the task list
. Deploy the new content type as a feature, both site columns and
content types by
o Deactivating custom task content types feature
o Uninstalling custom task content types feature
o Deactivating custom site columns feature
o Uninstalling custom site columns feature
o Installing custom site columns feature
o Activating custom site columns feature
o Installing custom task content types feature
o Activating custom task content types feature
o Usual IISRESET etc
. During the running of a workflow, that creates these tasks, the
code above runs and re-associates what should be the new content type.
What I seem to be observing however is that the programmatic association is
re-associating what appears to be the old content type, without the changes.
If after doing the deployment of the content type I re-associate then with
the task list through the task list setting UI, the new content type gets
associated correctly ... very odd
Can anyone see where I'm going wrong? Is the code above flawed?
Kind Regards,
Trevor Andrew
---
OzMOSS.com - to unsubscribe from this list, send a message back to the list
with 'unsubscribe' as the subject.
Powered by mailenable.com
_
This e-mail is intended for the use of the addressed recipient(s) only and
may contain confidential and privileged information. If you have received
this message in error, please delete the message and any attachments and
copies immediately; and notify the sender by return e-mail.
Any views expressed in this message or any attachments are those of the
individual sender and do not necessarily represent the corporate opinion of
the Catholic Education Office (CEO), Sydney.
The CEO Privacy Policy is located at http://www.ceo.syd.catholic.edu.au
---
OzMOSS.com - to unsubscribe from this list, send a message back