how can i update a contentlink?
Hello. i am trying to change an existing contentlink which links an image to a partner object, partner being a CustomModule, similar to product. using SiteFinity 5.
when we create the partner we choose an image with an image selector and it creates a contentlink between the partner and the image. that works.
as the partner is about to publish i intercept it at Decorator.ExecuteOnPublish(). here i create a copy of the selected image and put it into a new image library. that also seems to work (although the filepath doesnt change).
after the new image is created i try to setup/replace the existing contentlink to point to the new image with the following code:
ContentLinksManager cman = ContentLinksManager.GetManager();
if (cl != null)
Telerik.Sitefinity.Libraries.Model.Image img = FindImage(cl.ChildItemId);
if (img != null)
//create copy of the logo
Telerik.Sitefinity.Libraries.Model.Image newImage = CopySitefinityImageToLibrary(newAlbum, newPartner.Title + "_Logo", img);
if (newImage.Id != Guid.Empty)
cman.Delete(cl);
cman.SaveChanges();
Telerik.Sitefinity.Model.ContentLinks.ContentLink newCL =
cman.CreateContentLink("Logo", newPartner, newImage);
cman.SaveChanges();
the problem is that the new contentlink doesnt seem to work (but is in the DB). if i go back into the partner the image does not appear in the selector anymore and when i update the partner and get its contentlink, it is now NULL.
what else is needed to setup a contentlink properly? i am updating the MASTER partner item which i think is correct. as usual there is no documentation covering this so any help is appreciated.
just fyi, i think what i had above is correct.
the problem is with the newly copied image. the content link changes work if i use an image i uploaded through sitefinity.