0

I'm trying to add a component link to the Component link field of a page metadata using event system. I'm not sure why but its throwing an error asking for -16 at the end of the link which is a component.

A ComponentLinkField.value is a Component so I just set that to the Component Object I have.

When I go to save the page.Metadata it throws the following error where tcm:7-12361 is the component ID.

Invalid context Publication specified in URI: tcm:7-12361. Expecting: 16.

ComponentLinkField newCompLink = (ComponentLinkField)metadata[GetConfigKey("PageMetadataFieldName")]; newCompLink.Value = newLocalizedComp; page.Metadata = metadata.ToXml(); page.Save();

1
  • I figured it out. It was my own bad. It was not the -16 for component but my publication was actually "16." So I was setting the local page that was as 16 with a component link that was at 7 and thats why it was failing. Mar 15 '16 at 15:48
3

I figured it out. It was my own bad. It was not the -16 for component but my publication was actually "16." So I was setting the local page that was as 16 with a component link that was at 7 and thats why it was failing.

1
  • 1
    It's all about context. ;-)
    – Alvin Reyes
    Mar 15 '16 at 16:08

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.