AttachmentManager in Kentico 8

Keith Durrant asked on March 24, 2014 16:05

In Kentico 7 we're using CMS.DocumentEngine.AttachmentManager in a custom form control. We're trying to port the control to Kentico 8 and it no longer resolves. Any guidance would be appreciated.

Regards.

Correct Answer

Yehuda Lando answered on March 26, 2014 09:58

You can do it like that:

var attachmentInfo = AttachmentInfoProvider.GetAttachmentInfo(tempAttach.AttachmentGUID, SiteContext.CurrentSiteName);

attachmentInfo.AttachmentName = name;
attachmentInfo.AttachmentDescription = description;

AttachmentInfoProvider.SetAttachmentInfo(attachmentInfo);
0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on March 25, 2014 07:30

V8 isn't out yet and I don't believe full documentation is completed. Also the RC version you're using will not have an upgrade path to the full release of v8 so I'd suggest waiting until the full version comes out to make any code changes. Also there is typically a list of API changes that come out with the release. If you have support with Kentico, you might try calling or emailing them.

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on March 25, 2014 11:28

I'm building a site using v8 now. I believe you have to use CMS.DocumentEngine.AttachmentInfoProvider instead.

0 votesVote for this answer Mark as a Correct answer

Keith Durrant answered on March 25, 2014 13:24

Thanks Yehuda. I was instantiating an AttachmentManager to save an attachment with it's SetAttachmentInfo method. Can you advise on how to use the AttachmentInfoProvider to do the same thing?

0 votesVote for this answer Mark as a Correct answer

Keith Durrant answered on March 26, 2014 10:05

Hmm...Thanks Yehuda but in K8, AttachmentInfoProvider doesn't have a SetAttachmentInfo method.

0 votesVote for this answer Mark as a Correct answer

Keith Durrant answered on March 26, 2014 10:54

Apologies Yehuda. I was trying to use SetAttachmentInfo as an instance method. Your code sample works as described.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 26, 2014 23:04

Curious to find what you're both working on that you're developing in V8 already? What are your plans to upgrade to the full version from the RC version? Hoping they aren't client or production sites...

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.