Dynamics CRM 2016
Updated: November 29, 2016
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
Gets a compressed file that defines the ribbon.
Assembly: Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)
To extract the XML data from the compressed file, you have to use the System.IO.Packaging.ZipPackage class.
The following example is a helper method that is included in the SDK sample that you can find at SampleCode\CS\Client\Ribbon\ExportRibbonXml.
/// <summary> /// A helper method that decompresses the the Ribbon data returned /// </summary> /// <param name="data">The compressed ribbon data</param> /// <returns></returns> public byte[] unzipRibbon(byte[] data) { System.IO.Packaging.ZipPackage package = null; MemoryStream memStream = null; memStream = new MemoryStream(); memStream.Write(data, 0, data.Length); package = (ZipPackage)ZipPackage.Open(memStream, FileMode.Open); ZipPackagePart part = (ZipPackagePart)package.GetPart(new Uri("/RibbonXml.xml", UriKind.Relative)); using (Stream strm = part.GetStream()) { long len = strm.Length; byte[] buff = new byte[len]; strm.Read(buff, 0, (int)len); return buff; } }
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright
Community Additions
ADD
Show: