I'm deserializing from XML and running into a class conflict problem.
e.g.
In my code already, I'll be making reference to ContentType class which is actually living in Microsoft.SharePoint.Client.ContentType or the Web class living in Microsoft.SharePoint.Client.Web.
e.g
var parentCtType = (from c in rootWeb.ContentTypes where c.Name.ToLower().Trim() == ctParent.ToLower().Trim() select c).FirstOrDefault(); In my XML it reads as such:
<ContentTypes> <ContentType Name="D Base Document Set" Parent="Document Set" Group="*D"> <ContentTypeSiteColumns> <Sitecolumn DisplayName="Security" StaticName="SecurityClassification" Group="*DIAColumn" Type="TaxonomyFieldType" TermStore="D" TermSet="Security Classification" DefaultValue="UNCLASSIFIED" Required="TRUE" /> <Sitecolumn DisplayName="Enterprise" StaticName="Tax" Group="Enterprise Keywords Group" Type="TaxonomyFieldTypeMulti" TermStore="D" TermSet="N/A" /> </ContentTypeSiteColumns> </ContentType> <ContentType Name="D Base Document" Parent="Document" Description="The content type from which all other document content types will inherit." Group="*D"> <ContentTypeSiteColumns> <Sitecolumn DisplayName="Security Classification" StaticName="SecurityClassification" Group="*D" Type="TaxonomyFieldType" TermStore="D" TermSet="Security" DefaultValue="UNCLASSIFIED" Required="TRUE" /> <Sitecolumn DisplayName="Enterprise" StaticName="Tax" Group="Enterprise" Type="TaxonomyFieldTypeMulti" TermStore="D" TermSet="N/A" /> <Sitecolumn DisplayName="Notes" StaticName="Notess" Description="For notes giving context to the document. Additional information can include URL link to another document." Group="*D" Type="Note" Required="FALSE" /> </ContentTypeSiteColumns> </ContentType> In my class I'm deserializing to, I have a class called ContentType and Web (Pretty sure it has be named this since I'm deserializing from that XML with elements that name).
public class ContentType { [XmlAttribute] public string Name; [XmlAttribute] public string Parent; public List<Sitecolumn> ContentTypeSiteColumns; } So this class above has to be called ContentType(?) since that's what I'm deserializing to from the XML.
The errors I get are like:
Error 4 'testebby.ContentType' does not contain a definition for 'FieldLinks' and no extension method 'FieldLinks' accepting a first argument of type 'testebby.ContentType' could be found (are you missing a using directive or an assembly reference?) Which disappear if I call the class I'm deserializing to something different, like ContentTypeZ but then the deserializing process doesn't work.
How can I work around this? Hope it made sense.
No comments:
Post a Comment