Hello everybody, I just started working with Documentum
I am using DFS directly by WSDL. using MS Visual Studio, C#
By knowledge of object path, I can retrieve it from C# code. But its 'DataObject.Contents' is null, and so I can't use this to get a 'real' file.
Please take a look of what I'm doing wrong.
Here's my code:
public Byte[] DownloadFile(String _filename, String repository, String userName, String password)
{
Byte[] ret = null;
ObjectServicePortClient objectService = null;
objectService = new ObjectServicePortClient("ObjectServicePort"); // i.e. named binding in WCF-generated app.configs
ObjectPath op = new ObjectPath();
op.path = "/Administrator/" + _filename;
ObjectIdentity objectIdentity = new ObjectIdentity();
objectIdentity.Item = op;
objectIdentity.valueType = ObjectIdentityType.OBJECT_PATH;
objectIdentity.valueTypeSpecified = true;
objectIdentity.repositoryName = repository;
ObjectIdentitySet objectIdentitySet = new ObjectIdentitySet();
objectIdentitySet.Identities = new ObjectIdentity[] { objectIdentity };
PropertyProfile pp = new PropertyProfile();
pp.filterMode = PropertyFilterMode.ALL;
pp.filterModeSpecified = true;
pp.IncludeProperties = new string[] {"object_name", "content"};
ContentTransferProfile tp = new ContentTransferProfile();
tp.transferMode = ContentTransferMode.MTOM;
OperationOptions operationOptions = new OperationOptions();
operationOptions.Profiles = new Profile[2];
operationOptions.Profiles[0] = pp;
operationOptions.Profiles[1] = tp;
using (OperationContextScope scope = new OperationContextScope(objectService.InnerChannel))
{
OperationContext.Current.OutgoingMessageHeaders.Add(
new ServiceContextHeader(repository, userName, password));
try
{
DataPackage datapack = objectService.get(objectIdentitySet, operationOptions);
DataObject obj = datapack.DataObjects[0];
Content resultContent = obj.Contents[0];
DataHandlerContent dhc = resultContent as DataHandlerContent;
ret = dhc.Value;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
} // end using
return ret;
} // end function DownloadFile