Showing posts with label Document Management System. Show all posts
Showing posts with label Document Management System. Show all posts

Tuesday, August 28, 2012

Read / Write Files from document handling

Question:
How can you read / writes files from document handling?

Answer:

void fromFolderToDB(FilePath _path)
{
System.IO.DirectoryInfo         dir = new
System.IO.DirectoryInfo(_path);
System.IO.FileInfo[]            files;
System.IO.FileInfo              curFile;
System.Collections.IEnumerator  enumerator;
BinData                         binData;
DocuValue                       docuValue;
;
files = dir.GetFiles(_path);
enumerator = files.GetEnumerator();
while (enumerator.MoveNext())
{
curFile = enumerator.get_Current();
docuValue.clear();
binData.loadFile(curFile.get_FullName());   // get file content
docuValue.File      = binData.getData();
docuValue.FileName  = curFile.get_Name();
docuValue.insert(); // insert into DB
}
}
void fromDBToFolder(FilePath _path)
{
BinData                         binData;
DocuValue                       docuValue;
;
while select docuValue // load From DB
{
binData.setData(docuValue.File);
binData.saveFile(docuValue.FileName); // insert into file system
}
}
Make attention to CodeAccessPermission when reading/writing to file system
and when using CLR inside X++

Friday, June 1, 2007

Microsoft Dynamics AX Document Management System

Document management system in Microsoft Dynamics AX is used to attach documents, notes or images against specific records. All the documents are stored in DocuValue table with their reference in DocuRef table. In order to enable document management system we have to perform some simple steps.

Open Navigation Pane

Go to Basic -> Setup -> Document Management

Now you can see four options related to document management

Document types

Active document tables

Parameters

Document file extension

Now go open active document tables

Create a new entry (Ctrl + N)

Add your table in the grid and check mark active tab

Open AOT -> Data Dictionary -> Tables -> DocuRef table

open setSmmTable and place an entry of your table over here

void setSmmTable()

{

switch (this.RefTableId)

{

case tablenum(CustTable),

tablenum(VendTable),

tablenum(SalesTable),

tablenum(ProjTable),

tablenum(ContactPerson),

tablenum(smmActivities),

tablenum(SalesQuotationTable),

tablenum(smmMailings),

tablenum(smmBusRelTable),

tablenum(smmTMCallListTable),

tablenum(smmCampaignTable),

tablenum(smmEncyclopediaItems),

tablenum(smmCampaignSelection),

tablenum(yourtablename):

this.SmmTable = true;

break;

default:

this.SmmTable = false;

break;

}


}

Now you can see a document handling icon at the toolbar. You can use this icon to attach documents.