Hi all:
I'm getting exceptions when copying content type from one web to another:
foreach (SPContentType destinationWebCt in destinationWeb.ContentTypes)
{
destinationWeb.ContentTypes.Add(existingWebCt);
destinationWeb.Update();
}
existingWebCt is the content type from another web e.g. /Site/Web. destinationWeb is the web that I wish to copy the content type to e.g. /Site/DestinationWeb.
I got the SPException that says something like content type can not be added outside of its scope.
Then I decided to replace all "ContentTypes" to "AvailableContentTypes", but then I got the SPException saying this collcetion could not be modified.
So how can I copy a content type to another web?
Thanks.