"Existence of REport" Code Exception RRS feed

  • Question

  • Hi
    I have made a Report manually
    Now im checking its existance in C#. I get an exception
    Im Putting code here
    Kindly Check it and tell me where i am Doing mistake.

    Public void CheckCrmReport (string szReport, string szDomain, string szUser)
                    m_szErrorMsg = "User doesn't exist in Crm";
                    m_CrmService = m_DCRM4ServiceEgine.Service;

                    #region RetrieveByOrganization                 
                    ColumnSet colsOrganization = new ColumnSet();
                    colsOrganization.Attributes = new string[] { "name", "reportid" };

                    // Create a ConditionExpression.
                    ConditionExpression conditionUsersInOrganization = new ConditionExpression();                 
                    conditionUsersInOrganization.AttributeName = "address1_city";
                    conditionUsersInOrganization.Operator = ConditionOperator.Equal;
                    conditionUsersInOrganization.Values = new object[1] { "Okara" }; //new object[1];
                    FilterExpression filterUsersInOrganization = new FilterExpression();                
                    filterUsersInOrganization.FilterOperator = LogicalOperator.And;
                    filterUsersInOrganization.Conditions = new ConditionExpression[] { conditionUsersInOrganization };
                    QueryExpression queryUsersInOrganization = new QueryExpression();                
                    queryUsersInOrganization.EntityName = CRMServer.EntityName.report.ToString();//"systemuser";// 
                    queryUsersInOrganization.ColumnSet = colsOrganization;
                    queryUsersInOrganization.Criteria = filterUsersInOrganization;
                    RetrieveMultipleRequest retrieveUsersInOrganization = new RetrieveMultipleRequest();                
                    retrieveUsersInOrganization.Query = queryUsersInOrganization;
     RetrieveMultipleResponse retrievedUsers=(RetrieveMultipleResponse)m_CrmService.Execute(retrieveUsersInOrganization);                 
                    foreach (BusinessEntity entity in retrievedUsers.BusinessEntityCollection.BusinessEntities)
                        report user = (report)entity;
                        if (!string.IsNullOrEmpty(user.name))
                            if (user.name.ToLower() == szUserName.ToLower())
                                Console.WriteLine("fullname: " + user.name);
                                Console.WriteLine("domainname: " + user.createdon);
                                Console.WriteLine("systemuserid: " + user.reportid.Value);
                                m_szErrorMsg = "User exists in Crm";
                                return true;


    Im getting exception on this line
     RetrieveMultipleResponse retrievedUsers=(RetrieveMultipleResponse)m_CrmService.Execute(retrieveUsersInOrganization);

    Exception is
    "Server was unable to process request"

    Where i am doing mistake

    Can anyone tell me

    Any little help will be appreciated

    Thanks in Advance

    Sohaib Qazi
    Thursday, December 10, 2009 8:54 AM


  • Hi, Sohaib.

    It seems that there are no address1_city attribute in report entity.

    For detailed exception log try to use following code:

    RetrieveMultipleResponse retrievedUsers = null;

    retrievedUsers = (RetrieveMultipleResponse)m_CrmService.Execute(retrieveUsersInOrganization);
    catch(SoapException sexc)
    throw new Exception(sexc.Detail.InnerText);

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Thursday, December 10, 2009 10:32 AM