Hi, in this article i am gonna show how to retrieve the content of an “HTML Web Resource” in Microsoft Dynamics CRM 2011 by .Net
You need to perform 2 steps
1. perform a “RetrieveMultiple” call to pull back your web resource entity.
2. Decode the “content” property from base-64 to a string.
code :
RetrieveMultipleRequest RetrieveWebResources= new RetrieveMultipleRequest();
RetrieveMultipleResponse resp = new RetrieveMultipleResponse();
Entity webresource = new Entity();QueryExpression query = new QueryExpression()
{
EntityName = “webresource”,
ColumnSet = new ColumnSet(“content”),
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = “name”,
Operator = ConditionOperator.Equal,
Values = { “web resource name”}
}
}
}
};RetrieveWebResources.Query = query;
resp = (RetrieveMultipleResponse)_serviceproxy.Execute(RetrieveWebResources);
webresource= resp.EntityCollection.Entities[0];byte[] b = Convert.FromBase64String(webresource[“content”].ToString());
string strHTML = System.Text.Encoding.UTF8.GetString(b);
May 15, 2013 at 5:56 am
Grate Post . . . .! ! ! !
May 18, 2013 at 12:16 am
Thank you 🙂
July 9, 2013 at 4:55 am
Hi , is it possible to retrieve Document attached in annotation Eg:( word , pdf) and to display as string .