Archiv für den Monat: Juli 2009

Hallo mite. Hier spricht .NET

Wünsche viel Vergnügen beim Zeiten stoppen.

static void Main(string[] args)
{
   Configuration configuration = new Configuration();
   configuration.ApiKey = {apikey};
   configuration.Domain = new Uri("https://{domain}.mite.yo.lk");
 
   using (IDataContext context = new MiteDataContext(configuration))
   {
      Project project = new Project();
      project.Name = "mite.net";
 
      context.Create(project);
   }
}

Das Projekt ist auf Codeplex gehostet [ mitenet.codeplex.com ] und steht unter der MS-PL.

Howto: Retrieve members of a marketing list

Retrieving the members of a marketing list is for one reason a little bit trickier than retrieving other entities: there are no messages for operating with the listmember entity.

Once you have loaded the marketing list, for which you want to retrieve the members, you have to find out of what type the members are. The type of the members is stored in the membertype property of the marketing list.

Following method returns the name of the member entity type

internal string GetMemberType(CrmNumber crmNumber)
{
    switch (crmNumber.Value)
    {
        case ListType.Account:
            return EntityName.account.ToString();
        case ListType.Contact:
            return EntityName.contact.ToString();
        case ListType.Lead:
            return EntityName.lead.ToString();
        default:
            break;
    }
}

With this information we can create the query expression which we use to retrieve the list members.

BusinessEntityCollection RetrieveMembers(list marketinglist)
{
 
 string targetEntity = GetMemberType(marketinglist.membertype);
 
 QueryExpression query = new QueryExpression
 {
   EntityName = targetEntity;
   ColumnSet = new AllColumns();
 };
 
 // link from target entity to listmember
 LinkEntity linkToListMemberEntity = new LinkEntity
 {
   LinkFromEntityName = EntityName.account.ToString();
   LinkFromAttributeName = targetEntity + "id";
   LinkToEntityName = EntityName.listmember.ToString();
   LinkToAttributeName = "entityid";
 };
 
 //link from listmember to list
 LinkEntity linkToMarketingList = new LinkEntity
 {
   LinkFromEntityName = EntityName.listmember.ToString();
   LinkFromAttributeName = "listid";
   LinkToEntityName = EntityName.list.ToString();
   LinkToAttributeName = "listid";
 };
 
 // filter result with the id of the marketing list
 ConditionExpression marketingListIdCondition = new ConditionExpression
 {
   AttributeName = "listid";
   Operator = ConditionOperator.Equal;
   Values = new [] { marketinglist.listid.Value };
 };
 
 linkToMarketingList.LinkCriteria = new FilterExpression();
 linkToMarketingList.LinkCriteria.Conditions.Add(marketingListIdCondition);
 
 linkToListMemberEntity.LinkEntities.Add(linkToMarketingList);
 
 query.LinkEntities.Add(linkToListMemberEntity);
 
 BusinessEntityCollection members = service.RetrieveMultiple(query);
 
 return members;
}

Inhalt einer CHM-Datei wird nicht dargestellt

Wer kennt das Problem nicht. Man dokumentiert seinen Code, erstellt daraus per Sandcastle eine Dokumentation und erhält beim Öffnen derselben folgendes Problem. chm

Eine Ursache des Problems kann ein ‚#‚ im Pfad der Datei sein. Ein ‚#‘ stellt in HTML einen Anker dar, weshalb der CHM-Viewer die Inhalte der Datei nicht korrekt auflösen kann.

Weitere Erklärungen und andere Ursachen sind hier beschrieben: http://www.drexplain.com/press/chm-files-the-page-cannot-be-displayed-error/