QPR Knowledge Base 2017.1

SetBinaryData

SetBinaryData

Previous topic Next topic No directory for this topic  

SetBinaryData

Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 8.2

 

Sets a binary value to the given attribute of a given object (see also GetBinaryData).

 

Synopsis:

 

void SetBinaryData(string sessionId, string objectIds, string attribute, BinaryData value, string options)

 

Return Value:

 

None.

 

Parameters:

 

sessionId: String. ID of an authenticated session.

objectIds: String. A comma-separated list of Ids of objects to be modified (e.g. FullID of an attachment object attached to an action).

attribute: String. Name of the attribute to be set. (Note that only the EmbeddedData attribute is supported for QPR Portal's embedded attachment objects.)

value: Value as a BinaryData object. Depending on the attribute to be set, the operation either applies or ignores the values given in the BinaryData object. BinaryData.Content field is the only attribute that is always applied. For the EmbeddedData attribute, all the BinaryData attributes are applied.

options: String. A comma-separated list of options for the command. Note that there can be also product and object type specific mandatory options.

 

Example Procedure:

 

string fileName = "quality.docx";

BinaryData embeddedItem = new BinaryData();

 

FileStream fs = new FileStream(fileName, FileMode.Open);

 

embeddedItem.MimeType = "application/vnd.ms-word.document";

embeddedItem.FileName = fileName;

embeddedItem.Content = new byte[fs.Length];

 

fs.Read(embeddedItem.Content, 0, embeddedItem.Content.Length);

fs.Close();

 

ServiceClient client = new ServiceClient("WSHttpBinding_IService");

string sessionId = client.Authenticate("qpr", "demo");

 

client.SetBinaryData(sessionId, "PO.0.686650742", "embeddeddata", embeddedItem, "");

MessageBox.Show("Uploaded embedded data from file: " + fileName);

client.Close();