var objWeb = properties.Feature.Parent as SPWeb;
SPContentType contentType = objWeb.ContentTypes["Wiki Page"]; if (!contentType.Fields.ContainsField("Keywords")) { SPField field = objWeb.Fields["Keywords"]; SPFieldLink fieldLink = new SPFieldLink(field); contentType.FieldLinks.Add(fieldLink); contentType.Update(true); }
I use this code when activating the function to add the KeyWord site column to the site content type Wiki Page. My problem is to add the βkeywordβ to the βwiki pageβ, but not from an existing site column, it adds a new site column. is there a problem in my code?
one more thing, this code works fine on my MOSS server when I deploy this problem that I found on office365
source share