GetEntity Method

Retrieves specified data from Microsoft Dynamics GP. The data is returned as an XML string that represents the specified eConnect XML document.

Class

Microsoft.Dynamics.GP.eConnect.eConnectMethods

Syntax

public string GetEntity(string connectionString, string sXML)

Parameters

[spacer]

Name

Data type

Description

connectionString

string

Specifies your data server and database.

sXML

string

An eConnect XML document.


Return Value

Type: string

The string is an XML document that represents the requested data.

Remarks

To use the GetEntity method to retrieve a document, create an eConnect XML document that specifies the document to retrieve. The document must use the RQeConnectOutType schema and the eConnectOut node to identify the document.

If an error occurs, the method throws an eConnectException, application exception, or exception.

Examples

The following C# code example retrieves a single customer record. An eConnect requester document is used to specify the customer. Notice how the GetEntity method returns the specified customer data as an XML string.

// Specify the Microsoft Dynamics GP server and database in 
// the connection string
sConnectionString = @"data source=MySrvr;initial catalog=TWO;
	integrated security=SSPI;persist security info=False;
	packet size=4096";

// Specify the customer to retrieve
eConnectOut myRequest = new eConnectOut();
myRequest.DOCTYPE = "Customer";
myRequest.OUTPUTTYPE = 1;
myRequest.INDEX1FROM = "Customer001";
myRequest.INDEX1TO = "Customer001";
myRequest.FORLIST = 1;

// Create the eConnect requester XML document object
RQeConnectOutType[] eConnectOutType = 
	new RQeConnectOutType[1] { new RQeConnectOutType() };
eConnectOutType[0].eConnectOut = myRequest;

eConnectType eConnectDoc = new eConnectType();
eConnectDoc.RQeConnectOutType = eConnectOutType;

// Serialize the object to produce an XML document
MemoryStream memStream = new MemoryStream();

XmlSerializer serializer = new XmlSerializer(typeof(eConnectType));
serializer.Serialize(memStream, eConnectDoc);

memStream.Position = 0;

XmlDocument myDoc = new XmlDocument();
myDoc.Load(memStream);

// Retrieve the specified customer document
string myCustomer = e.GetEntity(sConnectionString, myDoc.OuterXml);


Documentation Feedback