21 Şubat 2013 Perşembe

CRM 4.0 -SAHİP ATAMA (OWNER ASSIGN)


public static void AssignEt(CrmService service, string entityname, Guid assignee, Guid targetid)
    {
      try
      {
        SecurityPrincipal sp = new SecurityPrincipal()
          {
            Type = SecurityPrincipalType.User,/*Eger takıma atama yapılacaksa SecurityPrincipalType.User */
            PrincipalId = assignee
          };

        AssignRequest assign = null;
        if (entityname.Trim().ToLower().Equals("account"))
        {
          TargetOwnedAccount account= new TargetOwnedAccount ()
          {
            EntityId = targetid
          };

          assign = new AssignRequest
          {
            Assignee = sp,
            Target = account
          };
        }
   
        if (assign != null)
          service.Execute(assign);
      }
      catch (Exception)
      {
      }
    }

Hiç yorum yok:

Yorum Gönder