Home > Forum > Plugins > Add attachments on the specific instances -SDK

Add attachments on the specific instances -SDK
0

MVP

Hi,
Do someone know how can to create an attachment instances with content and filegroup for send in specific instances?
I need for version sdk 2023
I attached the cod fromversion 2022.

NewAttachmentData newAttachmentData = new NewAttachmentData(args.Context,Configuration.informationNecessary.FileName, fileMerge_Necorupt);

newAttachmentData.FileGroup = new AttachmentsGroup(Configuration.informationNecessary.GropuName.Split('#')[0], Configuration.informationNecessary.GropuName.Split('#')[1]);

new DocumentAttachmentsManager(args.Context).AddAttachmentAsync(
new AddAttachmentParams() { Attachment = newAttachmentData, SkipPermissionsCheck = true, DocumentId = Convert.ToInt32(Configuration.informationNecessary.InstanceID) }
);

Thanks,
Raluca

Hello,

The public constructor for the NewAttachmentData class is no longer available. It is described in section 2.3 in the migration document https://developer.webcon.com/2023/resources/Migration-document_2023.1.pdf
In version 2023, you need to use the GetNewAttachment method from DocumentAttachmentsManager.

Your code migrated to version 2023 should look like this:

var manager = new DocumentAttachmentsManager(args.Context);
NewAttachmentData newAttachmentData = manager.GetNewAttachment(Configuration.informationNecessary.FileName, fileMerge_Necorupt);

newAttachmentData.FileGroup = new AttachmentsGroup(Configuration.informationNecessary.GropuName.Split('#')[0], Configuration.informationNecessary.GropuName.Split('#')[1]);

await manager.AddAttachmentAsync(
new AddAttachmentParams() { Attachment = newAttachmentData, SkipPermissionsCheck = true, DocumentId = Convert.ToInt32(Configuration.informationNecessary.InstanceID) }
);

PS. Don't forget to use await when using asynchronous methods :)

MVP
In reply to: Michał Bednarczyk

Hello,

The public constructor for the NewAttachmentData class is no longer available. It is described in section 2.3 in the migration document https://developer.webcon.com/2023/resources/Migration-document_2023.1.pdf
In version 2023, you need to use the GetNewAttachment method from DocumentAttachmentsManager.

Your code migrated to version 2023 should look like this:

var manager = new DocumentAttachmentsManager(args.Context);
NewAttachmentData newAttachmentData = manager.GetNewAttachment(Configuration.informationNecessary.FileName, fileMerge_Necorupt);

newAttachmentData.FileGroup = new AttachmentsGroup(Configuration.informationNecessary.GropuName.Split('#')[0], Configuration.informationNecessary.GropuName.Split('#')[1]);

await manager.AddAttachmentAsync(
new AddAttachmentParams() { Attachment = newAttachmentData, SkipPermissionsCheck = true, DocumentId = Convert.ToInt32(Configuration.informationNecessary.InstanceID) }
);

PS. Don't forget to use await when using asynchronous methods :)

Hi Raluca,

even so it's off-topic I want to remind you of a mail from WEBCON, you are probably aware of it and already taken appropriate measures.

___
In the upcoming system version (2024), we are implementing a mechanism to monitor whether SDK plugins come with authorized certificates. This is to ensure the security of the plugins created and used by our clients.

Therefore, if you are already creating or intend to create SDK add-ons (for yourself or your clients), please provide the key that signs the SDK add-ons you are creating (Public Key Token) via the support portal (through the business inquiry workflow)
___

On the other hand, we will now be required to build a new version for each WEBCON version now anyway.

https://daniels-notes.de/posts/2024/webcon-bps-2024-change-log#important-for-everyone

Best regards,
Daniel