Getting Object Description by Its Identifier

The example of using the GetObjects operation to get description of the repository object by its identifier. The request contains identifier of the searched object and additional parameters for searching and filtering objects. The search includes all repository folders (hidden folders included), and various container objects. The response contains description of the found object.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetObjects xmlns="http://www.fsight.ru/PP.SOM.Som">
<tParent xmlns="">
  <id>FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!0</id>
  </tParent>
<tFilter xmlns="">
  <levels>-1</levels>
  <includeRoot>false</includeRoot>
  <hideEmptyFolders>true</hideEmptyFolders>
  <hideAllFolders>true</hideAllFolders>
  <limit>1</limit>
<findInfo>
  <active>true</active>
  <text>NEWFORM</text>
  <attribute>Ident</attribute>
  <caseSensitive>false</caseSensitive>
  <wholeWordsOnly>true</wholeWordsOnly>
  <scanNestedNamespaces>true</scanNestedNamespaces>
  <scanHiddenFolders>true</scanHiddenFolders>
  </findInfo>
  </tFilter>
<tArg xmlns="">
  <pattern />
  </tArg>
  </GetObjects>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetObjectsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!0</id>
  </id>
<objects xmlns="">
<its>
<d isShortcut="0" isLink="0" hf="0">
  <i>NEWFORM</i>
  <n>NewForm</n>
  <k>304999</k>
  <c>1538</c>
  <p>0</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  </d>
  </its>
  </objects>
  </GetObjectsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetObjects" :
{
"tParent" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!0"
},
"tFilter" :
{
"levels" : "-1",
"includeRoot" : "false",
"hideEmptyFolders" : "true",
"hideAllFolders" : "true",
"limit" : "1",
"findInfo" :
{
"active" : "true",
"text" : "NEWFORM",
"attribute" : "Ident",
"caseSensitive" : "false",
"wholeWordsOnly" : "true",
"scanNestedNamespaces" : "true",
"scanHiddenFolders" : "true"
}
},
"tArg" :
{
"pattern" : ""
}
}
}

JSON response:

{
"GetObjectsResult" :
{
"id" :
{
"id" : "FNDKOLJACBNNFOAEDCEENEKPOGMMOOGEBLEIHFKEJOFOFMNJ!M!0"
},
"objects" :
{
"its" :
{
"d" :
{
"@isShortcut" : "0",
"@isLink" : "0",
"@hf" : "0",
"i" : "NEWFORM",
"n" : "NewForm",
"k" : "304999",
"c" : "1538",
"p" : "0",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
}
}
}
}
}
public static Od FindObjectById(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tObject = new GetObjects()
{
//Object filtering parameters
tArg = new GetObjectsArg()
{
pattern = new OdsPattern()
},
tFilter = new OdsFilt()
{
limit = 1,
levels = -1,
includeRoot = false,
hideAllFolders = true,
hideEmptyFolders = true,
findInfo = new OdFindInfo()
{
active = true,
attribute = OdFindAttribute.Ident,
caseSensitive = false,
scanHiddenFolders = true,
scanNestedNamespaces = true,
text = id,
wholeWordsOnly = true
}
},
//Specify identifier of the object, which child object are used in search
tParent = new OdId()
{
id = mb.id + "!0" //0 - key of repository root folder
}
};
//Get list of objects according to the specified selection parameters
var result = somClient.GetObjects(tObject);
//Check list of descriptions and return the first found description
//If the list if empty, return Null
var ods = result.objects;
if (ods.its.Length 0)
return ods.its[0];
else
return null;
}

See also:

GetObjects: Operation