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. Commented Mar 15, 2016 at 15:48

1 Answer 1

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. ;-) Commented Mar 15, 2016 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.