Showing posts with label Dynamics AX 2009. Show all posts
Showing posts with label Dynamics AX 2009. Show all posts

Monday, July 14, 2014

Getting a list of all projects

Question: How can i get a list of all projects in a system?

Answer: Use the code snippet below,

static void MSTA_Utility_ExportAllProjects(Args _args)
{
    #aot
    #properties
    #AviFiles
    SysOperationProgress    progressBar = new SysOperationProgress();

    TreeNode _treeNode;
    TreeNode projectNode;
    TreeNodeIterator iterator;
    int i, a;
    // Initialising progress bar
    progressBar.setCaption("Export To Excel in progress...");
    progressBar.setAnimation(#AviTransfer);

    _treeNode = infolog.projectRootNode();
    _treeNode = _treeNode.AOTfirstChild();

    for(i = 0; i < 2; i++)
    {
        iterator = _treeNode.AOTiterator();
        projectNode = iterator.next();
        while (projectNode)
        {
            progressBar.setText(strfmt("Project %1", projectNode.treeNodeName()));
            if(String::beginsWith(projectNode.treeNodeName(), "MSTA"))
            {
                info(projectNode.treeNodeName()) ;
            }
            projectNode = iterator.next();
            a++;
        }
        _treeNode = _treeNode.AOTnextSibling();
    }

}

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++

Wednesday, November 9, 2011

Dynamics AX 2009 Known Issues

Question  :


Is there a place to review all the knows Dynamics AX 2009 Issues ?


Answer:


Yes, kindly review the following link.
http://dynamicspost.blogspot.com/2011/04/ax-2009-known-issues-solutions.html