Tuesday, January 19, 2016

Is it possible to change folder type

You can use the below DQL to change the object type for one or more folders depending on certain criteria:

change <current_type> object(s) to <new_type> where <qualification>

In your case, it should be:

change dm_folder object to <custom_type> where r_object_id = ‘<object_id>’

where <custom_type> is your custom type name

and <object_id> is the r_object_id value of the folder that you want to change its object type

Monday, January 11, 2016

Patch code separator in Documentum Captiva


A patch is a pattern of parallel, alternating black bars and spaces that is printed on a page. Some scanners can detect patch codes and this information can be used by software for different purpose. Patch codes are used to separate documents, switch scanner modes on the fly or for other actions. Scan software can allow user assigning his/her own actions for detected patch codes.

There are different patch codes:

 

As a rule they are distributed with scanner driver if it supports patch reading feature and user just need print them and start to use. I used scanner DR-9080C from Canon and EMC QuickScanPro to demonstrate working with patch codes. Below there is ISIS driver configuration dialog for this scanner. To use patch codes you should choose ‘Patchcode’ item in ‘Batch separation’ combo box.


QuickScanPro allows assign different actions for this case. You can either start new document discarding patch code page or add it to a new document. I chose the second case.




PixTools for .NET

PixTools for .NET SDK provides great support for patch codes.
To enable patch code separator you should write following code

  1. if (m_Scanner.HWJobSeparator.Support)  
  2.     m_Scanner.HWJobSeparator.Value = PixHWJobSepMode.NoStopNoEject;  


and when page is scanned you should check if it is separator


  1. PageSide scannedSide = pipe.Run();  
  2. if(scannedSide.HWSeparator)  
  3.     //do something  


That’s all! I will be glad to hear your responses.
  

Saturday, January 9, 2016

Impossible to decrypt the method server response in D2

PROBLEM: D2 throwing error on statup - Unable to see repositories or D2-config screen
CAUSE: Missing lockbox configuration and RSA library files.
RESOLUTION / REASON : Re-configure lockbox for Application server, provided RSA library files.

STEPS:
  • Place the crypto-J 6.1.2 lib jar files in ../webapps/D2/WEB-INF/lib folder, and ../webapps/D2-Config/WEB-INF/lib folder.
    • cryptoj.jar
    • cryptpjce.jar
    • ceyptojcommon.jar
    • jcm.jar
    • jcmandroidfips.jar
    • jcmFIPS.jar
    • util.jar
  • Set jnlp.com.rsa.cryptoj.fips140loader=true in catalina.properties under Tomcat/conf/
  • regenerate the lockbox files for Application server making sure that it uses the same passphrase for both CS & APP SERVER.
  • Clear the Tomcat cache folder and restart Tomcat.

Wednesday, November 18, 2015

dm_check_password is returning "dm_check_password: Result = (245) = (DM_CHKPASS_BAD_LOGIN)"

If dm_check_password is returning "dm_check_password: Result = (245) = (DM_CHKPASS_BAD_LOGIN)" and it's permissions are ok, check the following: 

1) Check to check the permissions. They should be the following:
-rwsr-s--- 1 root dmadmins 11076 May 1 09:01 dm_check_password
2) If the permission is correct, check if the file system, which contains the Documentum software, is mounted with the nosuid option set.
You can check this for example in Solaris with the command 'mount'.
3) The correct output for the command mount should look like below.
/export/starfish6 on /dev/dsk/c0t3d0s6 read/write/setuid/largefiles on Thu Oct 10 07:09:08 2002 

If you see nosuid in the output it will ignore the sticky bit (rws) on that particular file system and the dm_check_password will not work. 

Please ask you UNIX administrator for further assistance if you need help to remount the file system using the setuid flag. 


can log in thru API on the Content Server but not through webtop or DA.

can log in thru API on the Content Server but not through webtop or DA.

checked to make sure root_task had been run, it had
checked ownership of the dm_check_password and it's cohorts and they were fine,
the mount point was mounted correctly 

dm_check_password DOES fail though with the DM_CHKPASS_BAD_LOGIN error (Result = (245)

Cause
dmadmin (installation owner account) is not being logged into directly, but being su'ed to...and without a password


Resolution
Unix admin must assign a password to the installation owner account (example:dmadmin)

Sunday, June 7, 2015

ARM Report issue

Issue:


I’m not able to gain access to the QD Dashboard Report, located under Analysis Reports tabs, as shown below?

The following comment appears on a separate window: “The item '/ARMInstance1/CustomReports/QD' cannot be found. (rsItemNotFound)”

 
Solution :
 
This is a know issue when there are spaces in the name for the report creating some problems with the URLs.  As a work around each report needs to have a description added or the spaces removed from the title.  It may be a good idea to do both, the description will be displayed to the end user not the title.  You can do this under the manage menu option for the report in /reports (hover over the report name for the menu to pop up). 

 

Once this has been done you'll need to remove the report from the quick launch menu group in ARM, save, and the add the report back into the group again.

Tuesday, March 31, 2015

DFS Consumer in DOTNET

Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Text
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports IDataAccess.ContextRegistryServiceReference
Imports IDataAccess.ObjectServiceReference
Imports IDataAccess.QueryServiceReference
Imports IDataAccess.SearchServiceReference
Imports System.ServiceModel
Imports System.Configuration
Imports System.Net
Imports System.IO

Namespace Documentum

Public Class DocumentStorageCustomDAL
Implements IDocumentStorageCustomDAL

Public Sub DeleteDocByStorageId(ByVal storageId As String) Implements IDataAccess.Documentum.IDocumentStorageCustomDAL.DeleteDocByStorageId
Try
Dim objectService As New ObjectServicePortClient("ObjectServicePort")

' Find a document to return
Dim q As New ObjectServiceReference.Qualification()
q.String = "dm_document WHERE r_object_id = '" & storageId & "'"
q.qualificationValueType = ObjectServiceReference.QualificationValueType.STRING
q.qualificationValueTypeSpecified = True

' Set the identity
Dim objectIdentity As New ObjectServiceReference.ObjectIdentity()
objectIdentity.valueType = ObjectServiceReference.ObjectIdentityType.QUALIFICATION
objectIdentity.valueTypeSpecified = True
objectIdentity.Item = q
objectIdentity.repositoryName = ConfigurationManager.AppSettings("repositoryName")
Dim objectIdentitySet As New IDataAccess.ObjectServiceReference.ObjectIdentitySet()
objectIdentitySet.Identities = New ObjectServiceReference.ObjectIdentity(0) {}
objectIdentitySet.Identities(0) = objectIdentity

' Specify the format to return (used when multiple renditions exist)
' FormatFilter.ANY should return the default format
Dim contentProfile As New IDataAccess.ObjectServiceReference.ContentProfile()
contentProfile.formatFilter = ObjectServiceReference.FormatFilter.ANY
'contentProfile.format = "crtext";
'contentProfile.format = "pdf"
'contentProfile.formatFilterSpecified = True

Dim operationOptions As New ObjectServiceReference.OperationOptions()
operationOptions.Profiles = New IDataAccess.ObjectServiceReference.Profile(0) {}
operationOptions.Profiles(0) = contentProfile

Dim dataPackage As ObjectServiceReference.DataPackage = Nothing

Using scope As New OperationContextScope(objectService.InnerChannel)
' Add the correct SOAP header

' Use the ServiceContext
Dim scx As New ServiceContextHeader()
Dim repoId As New RepositoryIdentity()
repoId.repositoryName = ConfigurationManager.AppSettings("repositoryName")
repoId.userName = ConfigurationManager.AppSettings("username")
repoId.password = ConfigurationManager.AppSettings("password")
scx.AddRepositoryIdentity(repoId)

OperationContext.Current.OutgoingMessageHeaders.Add(scx)
' Make the call
objectService.delete(objectIdentitySet, operationOptions)

End Using
Catch ex As SqlException

End Try
End Sub

Public Sub UpdateDocumentByStorageId(ByVal storageId As String, ByVal document As Byte()) Implements IDataAccess.Documentum.IDocumentStorageCustomDAL.UpdateDocumentByStorageId
Try

Catch ex As SqlException

End Try
End Sub


Public Sub DeleteDocByStorageId(ByVal storageIds As List(Of System.String)) Implements IDataAccess.Documentum.IDocumentStorageCustomDAL.DeleteDocByStorageIds

End Sub

Public Function UploadDocument(ByVal pdfDoc As DocumentStorageEntity) As String Implements IDataAccess.Documentum.IDocumentStorageCustomDAL.UploadDocument
Dim rObjectID As String = String.Empty
Try

Dim objectService As ObjectServicePortClient
objectService = New ObjectServicePortClient("ObjectServicePort")
Dim oi As ObjectServiceReference.ObjectIdentity
oi = New ObjectServiceReference.ObjectIdentity()
oi.repositoryName = ConfigurationManager.AppSettings("repositoryName").ToString()
Dim o As ObjectServiceReference.DataObject
o = New ObjectServiceReference.DataObject
o.Identity = oi
o.type = pdfDoc.ObjectType
Dim pp As ObjectServiceReference.PropertyProfile
pp = New ObjectServiceReference.PropertyProfile
pp.filterMode = ObjectServiceReference.PropertyFilterMode.ALL
Dim tp As ObjectServiceReference.ContentTransferProfile
tp = New ObjectServiceReference.ContentTransferProfile
tp.transferMode = ObjectServiceReference.ContentTransferMode.BASE64

Dim operationOptions As ObjectServiceReference.OperationOptions
operationOptions = New ObjectServiceReference.OperationOptions
Dim profile(2) As ObjectServiceReference.Profile
operationOptions.Profiles = profile
operationOptions.Profiles(0) = pp
operationOptions.Profiles(1) = tp
Dim pset As ObjectServiceReference.PropertySet
pset = New ObjectServiceReference.PropertySet

Dim doN As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
doN.name = "object_name"
doN.Value = pdfDoc.ObjectName

Dim dLN As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dLN.name = "locationnum"
dLN.Value = pdfDoc.LocationNumber

Dim dCN As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dCN.name = "contractnum"
dCN.Value = pdfDoc.ContractNumber

Dim dPN As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dPN.name = "purchasername"
dPN.Value = pdfDoc.PurchaseName

Dim dDN As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dDN.name = "deceasedname"
dDN.Value = pdfDoc.DeceasedName

Dim dDT As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dDT.name = "documenttype"
dDT.Value = pdfDoc.DocumentType

Dim dCT As ObjectServiceReference.StringProperty = New ObjectServiceReference.StringProperty
dCT.name = "contracttype"
dCT.Value = pdfDoc.ContractType

Dim ps As ObjectServiceReference.Property() = {doN, dLN, dCN, dPN, dDN, dDT, dCT}

pset.Properties = ps
o.Properties = pset
Dim dhc As ObjectServiceReference.DataHandlerContent
dhc = New ObjectServiceReference.DataHandlerContent
dhc.format = pdfDoc.ContentType
dhc.Value = pdfDoc.ReadDocument

o.Contents = New ObjectServiceReference.Content(0) {}
o.Contents(0) = dhc

Dim packageIn As ObjectServiceReference.DataPackage
packageIn = New ObjectServiceReference.DataPackage

Dim dataObjects() As ObjectServiceReference.DataObject = {o}

packageIn.DataObjects = dataObjects

Dim packageOut As ObjectServiceReference.DataPackage

Using scope As New ServiceModel.OperationContextScope(objectService.InnerChannel)

' Use the ServiceContext
Dim scx As New ServiceContextHeader()
Dim repoId As New RepositoryIdentity()
repoId.repositoryName = ConfigurationManager.AppSettings("repositoryName").ToString()
repoId.userName = ConfigurationManager.AppSettings("userName").ToString()
repoId.password = ConfigurationManager.AppSettings("password").ToString()
scx.AddRepositoryIdentity(repoId)
OperationContext.Current.OutgoingMessageHeaders.Add(scx)
Try
If objectService.State = CommunicationState.Created Then
packageOut = objectService.create(packageIn, operationOptions)
Dim retObj As ObjectServiceReference.ObjectId = TryCast(packageOut.DataObjects(0).Identity.Item, ObjectServiceReference.ObjectId)
rObjectID = retObj.id
End If
Catch ex As Exception
Return ex.Message
End Try
Return rObjectID
End Using

Catch ex As Exception

End Try
Return rObjectID
End Function


Public Function GetDocByObjectId(ByVal ObjectID As String) As GetFileData
Dim response As New GetFileData()
Try
Dim objectService As New ObjectServicePortClient("ObjectServicePort")

' Find a document to return
Dim q As New ObjectServiceReference.Qualification()
q.String = "dm_document WHERE r_object_id = '" & ObjectID & "'"
q.qualificationValueType = ObjectServiceReference.QualificationValueType.STRING
q.qualificationValueTypeSpecified = True

' Set the identity
Dim objectIdentity As New ObjectServiceReference.ObjectIdentity()
objectIdentity.valueType = ObjectServiceReference.ObjectIdentityType.QUALIFICATION
objectIdentity.valueTypeSpecified = True
objectIdentity.Item = q
objectIdentity.repositoryName = ConfigurationManager.AppSettings("repositoryName")
Dim objectIdentitySet As New IDataAccess.ObjectServiceReference.ObjectIdentitySet()
objectIdentitySet.Identities = New ObjectServiceReference.ObjectIdentity(0) {}
objectIdentitySet.Identities(0) = objectIdentity

' Specify the format to return (used when multiple renditions exist)
' FormatFilter.ANY should return the default format
Dim contentProfile As New IDataAccess.ObjectServiceReference.ContentProfile()
contentProfile.formatFilter = ObjectServiceReference.FormatFilter.SPECIFIED
'contentProfile.format = "txt"
contentProfile.format = "pdf"
contentProfile.formatFilterSpecified = True

Dim operationOptions As New ObjectServiceReference.OperationOptions()
operationOptions.Profiles = New IDataAccess.ObjectServiceReference.Profile(0) {}
operationOptions.Profiles(0) = contentProfile

Dim dataPackage As ObjectServiceReference.DataPackage = Nothing

Using scope As New OperationContextScope(objectService.InnerChannel)
' Add the correct SOAP header
' Use the ServiceContext
Dim scx As New ServiceContextHeader()
Dim repoId As New RepositoryIdentity()
repoId.repositoryName = ConfigurationManager.AppSettings("repositoryName")
repoId.userName = ConfigurationManager.AppSettings("username")
repoId.password = ConfigurationManager.AppSettings("password")
scx.AddRepositoryIdentity(repoId)
OperationContext.Current.OutgoingMessageHeaders.Add(scx)
' Make the call
dataPackage = objectService.get(objectIdentitySet, operationOptions)
End Using

' Dump the content to a file
' If Not dataPackage.DataObjects(0).Contents Is Nothing Then
For Each content As ObjectServiceReference.Content In dataPackage.DataObjects(0).Contents
Dim p As ObjectServiceReference.Property() = dataPackage.DataObjects(0).Properties.Properties
Dim fileName As String = "File"

' Set the filename to the object_name
For Each prop As ObjectServiceReference.Property In p
If prop.name = "object_name" Then
Dim sp As ObjectServiceReference.StringProperty = TryCast(prop, ObjectServiceReference.StringProperty)
If sp IsNot Nothing AndAlso String.IsNullOrEmpty(sp.Value) = False Then
fileName = sp.Value
Exit For
End If
End If
Next

' Check the format here
If content.format = "crtext" Then
fileName = IO.Path.ChangeExtension(fileName, "txt")
End If
If content.format = "pdf" Then
fileName = IO.Path.ChangeExtension(fileName, "pdf")
End If

' Put the file on the desktop
' fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), fileName);
' If ACS is used, the returned content will be UrlContent. If it's not used, the returned
' content will be BinaryContent
If TypeOf content Is IDataAccess.ObjectServiceReference.BinaryContent Then
'AddText("The content was returned as BinaryContent");
Dim binContent As IDataAccess.ObjectServiceReference.BinaryContent = DirectCast(content, IDataAccess.ObjectServiceReference.BinaryContent)
'SaveBytesToFile(binContent.Value, fileName);
'AddText("The file has been saved here: " + fileName);
Dim s As String = binContent.format()
response.ID = ObjectID
response.ObjectName = fileName
response.FileContents = binContent.Value
response.ErrorNo = False
'response.Extn = content.format
Return response
ElseIf TypeOf content Is IDataAccess.ObjectServiceReference.UrlContent Then
Dim urlContent As IDataAccess.ObjectServiceReference.UrlContent = DirectCast(content, IDataAccess.ObjectServiceReference.UrlContent)
'AddText("The content was returned as UrlContent.");
' AddText("The URL is: " + urlContent.url);
Dim url As New Uri(urlContent.url)
response.ID = ObjectID
response.ObjectName = fileName
response.FileContents = SaveUrlContentToByte(url)
response.ErrorNo = False
response.Extn = content.format
'AddText("The file has been saved here: " + fileName);
Return response
End If

Exit For
Next

response.ErrorNo = True
response.ErrorDetails = "All processing finshed but no data was found."

Return response
'Else
'response.ErrorDetails = "Document Object Not Found"
'response.ErrorNo = True
'End If

Catch ex As Exception
response.ErrorNo = True
response.ErrorDetails = ex.Message
Return response
End Try
End Function


Public Function SaveUrlContentToByte(ByVal url As Uri) As Byte()
Try
' Get the content from the ACS server
' Dim stream As IO.Stream = Nothing
Dim fstream As FileStream = Nothing
Dim response As HttpWebResponse = Nothing

Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
Using stream = response.GetResponseStream()
Dim buffer As Byte() = New Byte(32767) {}

Using ms As New MemoryStream()
While True
Dim read As Integer = stream.Read(buffer, 0, buffer.Length)
If read <= 0 Then
Return ms.ToArray()
End If
ms.Write(buffer, 0, read)
End While
End Using
End Using
Catch ex As Exception
' AddText(ex.Message);
Return Nothing
End Try
End Function


Public Function GetDocByStorageId(ByVal storageId As String) As DocumentStorageEntity Implements IDataAccess.Documentum.IDocumentStorageCustomDAL.GetDocByStorageId
Dim documentStorage As DocumentStorageEntity
Try

Catch ex As SqlException

End Try
Return documentStorage
End Function

Partial Friend Class SQLServerDocumentStorageCustomDALConstants
Public Const storageId As String = "StorageId"
Public Const ID As String = "ID"
Public Const DeleteDocByStorageId As String = "DeleteDocByStorageId"
Public Const UploadDoc As String = "UploadDoc"
Public Const GetDocByStorageId As String = "GetDocByStorageId"
Public Const UserId As String = "UserId"
Public Const Document As String = "Document"
Public Const ContentType As String = "ContentType"
Public Const CreatedDate As String = "CreatedDate"
Public Const UpdatedDate As String = "UpdatedDate"
Public Const DocumentName As String = "DocumentName"
Public Const UpdateDocByStorageId As String = "UpdateDocByStorageId"
End Class

Public Function GetExtensionofFile(ByVal objectId As String) As String
Dim response As New GetFileData()
Try
Dim objectService As New ObjectServicePortClient("ObjectServicePort")

' Find a document to return
Dim q As New ObjectServiceReference.Qualification()
'q.String = "dm_document WHERE r_object_id = '" & objectId & "'"
q.String = "dm_format WHERE r_object_id = '" & objectId & "'"

q.qualificationValueType = ObjectServiceReference.QualificationValueType.STRING
q.qualificationValueTypeSpecified = True

' Set the identity
Dim objectIdentity As New ObjectServiceReference.ObjectIdentity()
objectIdentity.valueType = ObjectServiceReference.ObjectIdentityType.QUALIFICATION
objectIdentity.valueTypeSpecified = True
objectIdentity.Item = q
objectIdentity.repositoryName = ConfigurationManager.AppSettings("repositoryName")
Dim objectIdentitySet As New IDataAccess.ObjectServiceReference.ObjectIdentitySet()
objectIdentitySet.Identities = New ObjectServiceReference.ObjectIdentity(0) {}
objectIdentitySet.Identities(0) = objectIdentity

' Specify the format to return (used when multiple renditions exist)
' FormatFilter.ANY should return the default format

Dim contentProfile As New IDataAccess.ObjectServiceReference.ContentProfile()
contentProfile.formatFilter = ObjectServiceReference.FormatFilter.ANY
'contentProfile.format = "txt"
'contentProfile.format = "pdf"
contentProfile.formatFilterSpecified = True

Dim operationOptions As New ObjectServiceReference.OperationOptions()
operationOptions.Profiles = New IDataAccess.ObjectServiceReference.Profile(0) {}
operationOptions.Profiles(0) = contentProfile

Dim dataPackage As ObjectServiceReference.DataPackage = Nothing

Using scope As New OperationContextScope(objectService.InnerChannel)
' Add the correct SOAP header
' Use the ServiceContext
Dim scx As New ServiceContextHeader()
Dim repoId As New RepositoryIdentity()
repoId.repositoryName = ConfigurationManager.AppSettings("repositoryName")
repoId.userName = ConfigurationManager.AppSettings("username")
repoId.password = ConfigurationManager.AppSettings("password")
scx.AddRepositoryIdentity(repoId)
OperationContext.Current.OutgoingMessageHeaders.Add(scx)
' Make the call
dataPackage = objectService.get(objectIdentitySet, operationOptions)
End Using

Dim fileName As String = String.Empty
' Dump the content to a file
' If Not dataPackage.DataObjects(0).Contents Is Nothing Then
For Each content As ObjectServiceReference.Content In dataPackage.DataObjects(0).Contents
Dim p As ObjectServiceReference.Property() = dataPackage.DataObjects(0).Properties.Properties

' Set the filename to the object_name
For Each prop As ObjectServiceReference.Property In p
If prop.name = "dos_extension" Then
Dim sp As ObjectServiceReference.StringProperty = TryCast(prop, ObjectServiceReference.StringProperty)
If sp IsNot Nothing AndAlso String.IsNullOrEmpty(sp.Value) = False Then
fileName = sp.Value
Exit For
End If
End If
Next

' Check the format here
If content.format = "crtext" Then
fileName = IO.Path.ChangeExtension(fileName, "txt")
End If
If content.format = "pdf" Then
fileName = IO.Path.ChangeExtension(fileName, "pdf")
End If
Exit For
Next
Return fileName
Catch ex As Exception

End Try

End Function

Public Structure GetFileData

Public ErrorNo As Boolean

Public ErrorDetails As String

Public ID As String

Public ObjectName As String

Public FileContents As Byte()

Public Extn As String

End Structure

End Class
End Namespace


--- This is another class with in that business layer


' This sample code has been built using EMC Documentum Foundation Services (DFS)
' version 6.5 SP1, Visual Studio 2008 and .NET 3.5 (Windows Communication Foundation
' "v2" and LINQ to XML--System.Xml.Linq). It is not supported by EMC.
'
' In order to build and run this sample you must have DFS 6.5 SP1 (i.e. its web
' services) properly deployed (e.g. into a JEE application server such as JBoss
' 4.2.2).
'
' The primary intent of this sample code is to demonstrate direct-to-WSDL consumption
' of DFS using standard Microsoft tools (Visual Studio) and frameworks (WCF).
'
' Please visit the EMC Developer Network for more on DFS:
' https://community.emc.com/community/edn/documentum
Imports System.Collections.Generic
Imports System.Globalization
Imports System.ServiceModel.Channels
Imports System.Xml
Imports System.Xml.Serialization

Imports System.IO
Imports System.Xml.Linq

Imports IDataAccess.ContextRegistryServiceReference

Namespace Documentum
Friend Class ServiceContextHeader
Inherits MessageHeader
Private ReadOnly repositoryIdentities As New List(Of RepositoryIdentity)()
Private contentTransferProfile As ContentTransferProfile

Public Sub AddRepositoryIdentity(ByVal rid As RepositoryIdentity)
If rid Is Nothing Then
Exit Sub
End If

repositoryIdentities.Add(rid)
End Sub

Public Sub AddContentTransferProfile(ByVal ctp As ContentTransferProfile)
If ctp Is Nothing Then
Exit Sub
End If

contentTransferProfile = ctp
End Sub

Protected Overloads Overrides Sub OnWriteHeaderContents(ByVal writer As XmlDictionaryWriter, ByVal messageVersion As MessageVersion)
' If there are no ids, do nothing
If repositoryIdentities.Count < 1 Then
Exit Sub
End If

' Add ids to the ServiceContext
Dim serviceContext As New ServiceContext()
serviceContext.Identities = New Identity(repositoryIdentities.Count - 1) {}
For x As Integer = 0 To repositoryIdentities.Count - 1
serviceContext.Identities(x) = repositoryIdentities(x)
Next

' If there is a ContentTransferProfile, add it
If contentTransferProfile IsNot Nothing Then
serviceContext.Profiles = New ContentTransferProfile(0) {}
serviceContext.Profiles(0) = contentTransferProfile
End If

' Serialize the objects to XML
Dim doc As XDocument = Nothing
Using sw As New StringWriter(CultureInfo.CurrentCulture)
Dim xs As New XmlSerializer(GetType(ServiceContext))
xs.Serialize(sw, serviceContext)
doc = XDocument.Load(New StringReader(sw.ToString()))
End Using

' Add Identities to the ServiceContext header
For Each el As XElement In doc.Descendants(XName.[Get]("Identities", "http://context.core.datamodel.fs.documentum.emc.com/"))
Dim r As XmlReader = XmlReader.Create(New StringReader(el.ToString()))
writer.WriteNode(r, True)
Next

' Add Profiles to the ServiceContext header
If serviceContext.Profiles IsNot Nothing Then
For Each el As XElement In doc.Descendants(XName.[Get]("Profiles", "http://context.core.datamodel.fs.documentum.emc.com/"))
Dim r As XmlReader = XmlReader.Create(New StringReader(el.ToString()))
writer.WriteNode(r, False)
Next
End If
End Sub

Public Overloads Overrides ReadOnly Property Name() As String
Get
Return "ServiceContext"
End Get
End Property

Public Overloads Overrides ReadOnly Property [Namespace]() As String
Get
Return "http://context.core.datamodel.fs.documentum.emc.com/"
End Get
End Property
End Class
End Namespace


--- create a webpage... and paste this code

Imports IDataAccess.Documentum
Imports System.IO
Imports System.Configuration



Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub btnSendDocument_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSendDocument.Click

Try
Dim objEntity As New DocumentStorageEntity
Dim objFile As New FileInfo(fuBrowse.FileName)
objEntity.ObjectName = txtLocationNum.Text + "-" + txtContractNum.Text + "-" + txtDocumentType.Text
objEntity.ObjectType = "customercontract"
If fuBrowse.HasFile Then
objEntity.ReadDocument = fuBrowse.FileBytes()
Else
Return
End If
objEntity.LocationNumber = txtLocationNum.Text
objEntity.ContractNumber = txtContractNum.Text
objEntity.PurchaseName = txtPurName.Text
objEntity.DeceasedName = txtDeceasedName.Text
objEntity.DocumentName = fuBrowse.FileName
objEntity.ContentType = "pdf" 'objFile.Extension
objEntity.ContractType = "Trust Contract"
objEntity.DocumentType = txtDocumentType.Text
Dim objDocument As New DocumentStorageCustomDAL
lblDocumentId.Text = "Document Id is:- " + objDocument.UploadDocument(objEntity)

Catch ex As Exception
Response.Write(ex.ToString())
End Try

End Sub

Protected Sub btnGetDoc_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnGetDoc.Click
Try
Dim objDocument As New DocumentStorageCustomDAL
Dim objGetFile As DocumentStorageCustomDAL.GetFileData
objGetFile = objDocument.GetDocByObjectId(txtGetDoc.Text)
If (objGetFile.ErrorNo = False) Then
Dim url As String = AppDomain.CurrentDomain.BaseDirectory & "GetFile." & objGetFile.Extn
Using binWriter As New BinaryWriter(File.Open(url, FileMode.Create))
binWriter.Write(objGetFile.FileContents)
End Using
System.Diagnostics.Process.Start(url)
End If
Catch ex As Exception
Response.Write(ex.ToString())
End Try
End Sub

Protected Sub btnDeleteDoc_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDeleteDoc.Click

Try
Dim objDocument As New DocumentStorageCustomDAL
Dim fileExt As String
fileExt = objDocument.GetExtensionofFile(txtGetDoc.Text)
lblDocumentId.Text = fileExt

'objDocument.DeleteDocByStorageId(txtGetDoc.Text)
'lblDocumentId.Text = txtGetDoc.Text + " Deleted Successfully"
Catch ex As Exception
Response.Write(ex.ToString())
End Try
End Sub
End Class