Solved

Attempting to retrieve all queueitems from a given queue causes NullReferenceException

Posted on 2009-07-06
2
1,842 Views
Last Modified: 2012-05-07
Hi,

We are attempting to write a dashboard/console page for our Dynamics CRM 4 implementation.  As part of this we are trying to display all the emails in our "Support" queue in a GridView control.  Unforuntately everytime we attempt to run the retrievemultiple request on the queueitems we want CRM throws a platform error.  The tracelog shows it to be a NullReferenceException.  We know the GUID for the support queue is correct (contained in the support.queueid.Value attribute).  The request is running under my credentials, and I have administrator access to the system.

Anyone know something that could point me in the right direction to solve this?  Code sample and tracelog below.
Code Sample:
 

            //Fetch data from CRM

            QueryByAttribute queueQuery = new QueryByAttribute();

            queueQuery.EntityName = EntityName.queueitem.ToString();

            queueQuery.Attributes = new string[] { "queueid" };
 

            Lookup supportQueue = new Lookup(EntityName.queue.ToString(), support.queueid.Value);
 

            queueQuery.Values = new Lookup[] { supportQueue };

            queueQuery.ColumnSet = new ColumnSet(new string[] { "objecttypecode", "objectid", "queueitemid" });
 

            BusinessEntityCollection bec;
 

            try

            {

                bec = service.RetrieveMultiple(queueQuery);

            }

            catch (SoapException SoEx)

            {

                throw new Exception("Multiple Request Failure 1: " + SoEx.Detail.InnerText);

            }
 

-----

Tracelog:
 

[2009-07-06 13:55:48.7] Process: w3wp |Organization:e4dc1a83-46ba-4557-9843-35e9861795c8 |Thread:   20 |Category: Platform |User: 486abca3-a334-dd11-ae75-0019bbd1721a |Level: Error | MessageProcessor.Execute

	at MessageProcessor.Execute(PipelineExecutionContext context)

	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)

	at ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)

	at CrmServiceInternal.RetrieveMultiple(String namespaceName, QueryBase query, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)

	at CrmService.RetrieveMultiple(QueryBase query)

	at RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

	at RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

	at LogicalMethodInfo.Invoke(Object target, Object[] values)

	at WebServiceHandler.Invoke()

	at WebServiceHandler.CoreProcessRequest()

	at SyncSessionlessHandler.ProcessRequest(HttpContext context)

	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

	at ApplicationStepManager.ResumeSteps(Exception error)

	at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)

	at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)

	at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)

	at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)

>MessageProcessor fail to process message 'RetrieveMultiple' for 'queueitem'.

[2009-07-06 13:55:48.7] Process: w3wp |Organization:e4dc1a83-46ba-4557-9843-35e9861795c8 |Thread:   20 |Category: Platform.Sdk |User: 486abca3-a334-dd11-ae75-0019bbd1721a |Level: Error | CompositeSoapExtensionExceptionHandler.Handle

	at CompositeSoapExtensionExceptionHandler.Handle(Stream to, Stream from, Exception exception)

	at CrmAuthenticationSoapExtensionBase.ProcessMessage(SoapMessage message)

	at SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)

	at SoapServerProtocol.WriteException(Exception e, Stream outputStream)

	at WebServiceHandler.WriteException(Exception e)

	at WebServiceHandler.Invoke()

	at WebServiceHandler.CoreProcessRequest()

	at SyncSessionlessHandler.ProcessRequest(HttpContext context)

	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

	at ApplicationStepManager.ResumeSteps(Exception error)

	at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)

	at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)

	at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)

	at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)

>CrmSoapExtension detected non-CrmException - report will be sent to Watson:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.

   at Microsoft.Crm.Query.ConditionExpression..ctor(AttributeMetadata attribute, ConditionOperator conditionOperator, Array values, Boolean isCustom, Guid organizationId)

   at Microsoft.Crm.Query.EntityExpression.FromQueryVisitor.Visit(QueryByAttribute query)

   at Microsoft.Crm.Sdk.Query.QueryByAttribute.Accept(IQueryVisitor visitor)

   at Microsoft.Crm.Query.EntityExpression..ctor(QueryBase query, DynamicMetadataCache dynamicCache, Guid organizationId)

   at Microsoft.Crm.Query.EntityExpression.Converter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)

   at Microsoft.Crm.BusinessEntities.ConversionHelpers.Convert(ICrmConversionContext conversionContext, Object source, Type destinationType)

   at Microsoft.Crm.Sdk.DictionaryMapper.Map(PropertyBag inputs, ICrmConversionContext context)

   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IPluginExecutionContext context)

   at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)

   at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)

   at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)

   at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)

   at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)

   at Microsoft.Crm.Sdk.CrmServiceInternal.RetrieveMultiple(String namespaceName, QueryBase query, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)

   at Microsoft.Crm.Sdk.Crm2007.CrmService.RetrieveMultiple(QueryBase query)

Open in new window

0
Comment
Question by:GGUser
2 Comments
 
LVL 11

Accepted Solution

by:
rakeshAgarwal earned 500 total points
ID: 24785311
just try this out

queueQuery.Values = new string[] { support.queueid.Value};
0
 
LVL 1

Author Comment

by:GGUser
ID: 24785713
That's done it, once I changed the code to get around a bug in the SDK.

Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS CRM 2011 3 78
ms dynamics 2011 7 59
Dynamics CRM - Windows application - How to get field names ? 4 98
CRM 2011 Ribbon Workbench vs RibbonDiffXml 44 256
Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now