Free Support Forum - aspose.com

Event-hanlder is not getting invoked

Hi

I am new user for ASPOSE.WORDS for .NET.

I have written event-handler for sharepoint document library which will update custom properties of "Word Document" by help of ASPOSE.WORDS for .NET.

Issue : Event-hanlder is not getting invoked and not updating properties, also debuging functionality not working.

I have checked same code in ASP.Net and its worked there.

Observation : After removing the reference of ASPOSE.WORDS for .NET, I am able to debug code.

Please suggest on this issue.

Best regrds,

Sujitkumar Patil

Hi Sujitkumar,


Thanks for your inquiry and sorry for the delayed response. We’re checking with this scenario and will get back to you soon.

Best Regards,

Hi Team,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your response.

This is an environmental issue and after rebooting sever issue got resolved.

Now I am looking help for below Issue.

I have written below event-handler for SharePoint document library which will update custom properties of word.

Background : I have created document content type and added sample template which have custom properties (Author Name, Document ID, Document version etc).

User will create document using this template and save it in document library.

Task : Once user click on save button, custom properties of word should modify immediately.

Code : "ItemAdded" events gets executed in SharePoint when user click on save button and here I have written my code which will update custom properties by help of ASPOSE.WORDS for .NET.

public override void ItemAdded(SPItemEventProperties properties)

{

UpdateWordProperties(Item["Doc_ID"].ToString(), Item["Version_No"].ToString(), ref properties);

base.ItemAdded(properties);

}

private void UpdateWordProperties(string strDocID, string strVersion, ref SPItemEventProperties properties)

{

Document doc = new Document(properties.ListItem.File.OpenBinaryStream());

if (!doc.WriteProtection.IsWriteProtected)

{

CustomDocumentProperties objCustProperty = doc.CustomDocumentProperties;

objCustProperty["Doc_ID"].Value = strDocID;

objCustProperty["Version_No"].Value = strVersion;

doc.AcceptAllRevisions();

doc.Save(properties.ListItem.File.OpenBinaryStream(), SaveFormat.Doc);

}

}

Issue : Word custom properties not getting update.

Hi Sujitkumar,


Thanks for the additional information. We have just released a new version of Aspose.Words for .NET i.e. 11.8.0; please download it from the following link and let us know how it goes on your side?
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

In case the problem still remains, could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,