This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SPSecurity.RunWithElevatedPrivileges(delegate() | |
{ | |
SPFile formFile = workflowProperties.Item.File; | |
MemoryStream ms = new MemoryStream(formFile.OpenBinary()); | |
XmlTextReader rdr = new XmlTextReader(ms); | |
XmlDocument xmlDoc = new XmlDocument(); | |
xmlDoc.Load(rdr); | |
rdr.Close(); | |
ms.Close(); | |
XmlNamespaceManager nsm = new XmlNamespaceManager(xmlDoc.NameTable); | |
// FYI, this was the schema I found for mine, for whatever reason yours maybe different, but it should be located as an attribute of your Document | |
String schemaUri = xmlDoc.DocumentElement.GetAttributeNode("xmlns:my") != null ? xmlDoc.DocumentElement.GetAttributeNode("xmlns:my").Value : "http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-09-04T20:19:31"; | |
nsm.AddNamespace("my", schemaUri); | |
XmlNode nodeSignatureCollection = xmlDoc.DocumentElement.SelectSingleNode("my:signatures1", nsm); | |
if (nodeSignatureCollection != null) | |
{ | |
if (nodeSignatureCollection.HasChildNodes) | |
{ | |
foreach (XmlNode nodeSignature in nodeSignatureCollection.ChildNodes) | |
{ | |
// HERE IT IS!!! | |
if (nodeSignature.HasChildNodes && !nodeSignature.IsReadOnly) nodeSignature.RemoveAll(); | |
} | |
} | |
} | |
byte[] xmlData = System.Text.Encoding.UTF8.GetBytes(xmlDoc.OuterXml); | |
formFile.SaveBinary(xmlData); | |
formFile.Update(); | |
}); |
digital signature FAQ
ReplyDeleteThank you for the explanation! I looked for this information hours and I tried to do a lot of things but nothing worked. On your blog I can always find what I need. Thank you so much !
Digital Signature Certificate is very expensive.
ReplyDeleteCan I implement or create Electronic Signature in InfoPath 2010 or SharePoint 2010 Workflow?
It seems Collect Signature in SharePoint Workflow working on Digital Signature only.
digital signatures