Microsoft MVP 2016 – Business Solutions – Dynamics CRM

indexI am proud to announce that I just received my 1st Microsoft MVP Award for my focus in Business Solutions – Dynamics CRM.

Congratulations! We are pleased to present you with the 2016 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in Business Solutions technical communities during the past year.

Also in this email:

About your MVP Award Gift
How to claim your award benefits
Your MVP Identification Number
MVP Award Program Code of Conduct

The Microsoft MVP Award provides us the unique opportunity to celebrate and honor your significant contributions and say “Thank you for your technical leadership.”

Patrick Malone
Community & Advocacy Programs

The Microsoft MVP award and the included opportunities add a huge benefit like the Microsoft MVP summit where you have the chance to talk to the Microsoft Product Groups, learn and place feedback. But of course the Microsoft MVP award also adds some other great advantages.

Of course there are a lot of people I have to thank, but I want to keep the list as short as possible. I would like to thank my employer which is supporting me in the best possible way year over year, my current and former colleagues, the Microsoft MVP community and of course Microsoft employees in Redmond and all over the world.


CRM2011/2016 – Timeout problem when open Sharepoint documents from CRM

Today I had a big problem with our new customer: When they tried to open a document from CRM, they had an error:


After check a little bit, I found a timeout error on sharepoint.  The problem was the Cookie life time configuration:

[..]When using FBA or a trusted provider, SharePoint will set a cookie on the client called FedAuth. I’ll not go into the details of what’s inside the FedAuth cookie. Of course, the FedAuth cookie will have by default a certain lifetime. Session cookies can be configured too making the cookie invalid after the closing the browser and then bypassing the value in this settings.

The default value is 5 days.[..] (Microsoft text)


To resolve the problem I found this script:

$sts = Get-SPSecurityTokenServiceConfig
$sts.CookieLifetime = New-TimeSpan -Hours 7

At the end I restart IIS and all is run in right way.

#CRM2016 – Get all teams by user in C#

public Microsoft.Xrm.Sdk.EntityCollection UserTeams(Guid UserID)

    QueryExpression query = new QueryExpression("team");
    query.ColumnSet = new ColumnSet(true);
    LinkEntity link = query.AddLink("teammembership", "teamid", "teamid");
    link.LinkCriteria.AddCondition(new ConditionExpression("systemuserid", ConditionOperator.Equal, UserID));

      return service.RetrieveMultiple(query);
    catch (Exception ex)
       // Do your Error Handling here
       throw ex;

CRM2016 – Check if User is a member of a team C#

The code is the following:

public static bool IsTeamMember(Guid teamID, Guid userID, IOrganizationService service)
QueryExpression query = new QueryExpression("team");
query.ColumnSet = new ColumnSet(true);
query.Criteria.AddCondition(new ConditionExpression("teamid", ConditionOperator.Equal, teamID));
LinkEntity link = query.AddLink("teammembership", "teamid", "teamid");
link.LinkCriteria.AddCondition(new ConditionExpression("systemuserid", ConditionOperator.Equal, userID));
var results = service.RetrieveMultiple(query);

if (results.Entities.Count > 0)
return true;
return false;

CRM 2016 – Get all activities related with a user with C#

Today I need to get all activities related with a specific user. The way it to easy: We can use FetchXM or Query Expression. I usually prefer use Query Expression.
The code is easy:

private List<Entity> GetAssociatedActivities(EntityReference regarding)
            QueryExpression query = new QueryExpression { EntityName = "activitypointer", ColumnSet = new ColumnSet(new string[] { "activitytypecode" }) };
            query.Criteria.AddCondition("regardingobjectid", ConditionOperator.Equal, regarding.Id);
            query.Criteria.AddCondition("statecode", ConditionOperator.NotEqual, 1);  //ignore completed
            EntityCollection collection = _sdk.RetrieveMultiple(query);
            return collection.Entities.ToList();

That’s all.

CRM2016 – Getting use of PublishXmlRequest SDK message to publish an Entity or a Web Resource

Today I had a timeout error on my application when I tried to use PublishAllXmlRequest .I resolved to use a single PublishXmlRequest in this way:

#region Publish FormXMl
//Publish entity for which formxml has been changed 
PublishXmlRequest publishRequest = new PublishXmlRequest();
publishRequest.ParameterXml ="<importexportxml>" +
"    <entities>" +
"        <entity>" + entityName + "</entity>" +
"    </entities>" +
"    <nodes/>" +
"    <securityroles/>  " +
"    <settings/>" +
"    <workflows/>" +

catch (Exception ex)
    throw new ex