Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Help: Need to retrieve SharePoint document records for a given Opportunity

$
0
0

Hello,

So I thought this would be easier than I am having :-) it be.

I have an opportunityid. That opportunity has several documents loaded. I need an example please of how exactly to retrieve the SharePoint documents related too it, so I can grab the details about those documents.

However, for some reason I can't see to get the details.

*Simple Check. I tried to retrieve all the SharePoint document records but it returns 0 entity records, even though there are in fact 7 document locations and I added 3 documents, which do come up in the UI under that opportunity.

I would be very grateful for very specific code related help, a link is fine too, but I've not found one with actual code for doing it.

I figured I needed to use the relationship Opportunity_SharepointDocument, but I just get a server 500 error.

Here is that code

QueryExpression query = newQueryExpression();

query.EntityName = SharePointDocument.EntityLogicalName;

query.ColumnSet = newColumnSet(true);

Relationship relationship = newRelationship();

relationship.SchemaName = "Opportunity_SharepointDocument";

RelationshipQueryCollection relatedEntity = newRelationshipQueryCollection();

relatedEntity.Add(relationship, query);

RetrieveRequest request = newRetrieveRequest();

request.RelatedEntitiesQuery = relatedEntity;

request.ColumnSet = newColumnSet(true);

request.Target = newEntityReference { Id = newGuid("myopptyhere"), LogicalName = Opportunity.EntityLogicalName };

RetrieveResponse response = (RetrieveResponse)_sourceServiceProxy.Execute(request);

//get's back an "unexpected error"

Is this code at least correct and maybe the server has an issue or my sharepoint config?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>