AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 23.01.2009, 01:07   #1  
Blog bot is offline
Blog bot
Участник
 
25,607 / 848 (80) +++++++
Регистрация: 28.10.2006
Arijit Basu: AX 2009 Document Management & MOSS / WSS
Источник: http://daxguy.blogspot.com/2009/01/a...-moss-wss.html
==============

Recently I was re looking at AX 2009 Document Management capabilities (Which is pretty limited) and trying to find some way to extend it. Since AX 3.x, the AX Document Management has hardly undergone any major changes. I was doing a POC on AX 2009 Document Management capabilities & MOSS. Since MOSS/WSS is an integral part of AX 2009, it would be a nice idea to integrate these so as to be able to take full advantage of the document features of MOSS/WSS. However there were challenges like Security, referential integrity etc which posed a challenge. However I did some R & D and created a POC which lets users attach documents to a MOSS Document library along with AX Metadata using the base AX 2009 Document handling functionality. Although its not complete and far from perfect, it opens up a new vista for developers who want to extend AX Document handling to MOSS.


If you are aware of the basics of WSS/MOSS, there are Web Services [_vti_bin\] (Specially copy.asmx) which lets u programatically upload documents. Other than that Microsoft,Sharepoint.dll also has some interesting methods which let u do the same .

The first step was to create a MOSS Site (Document Centre template - MOSS 2007 SP1). Now I needed to store documents of various AX Modules so I created subsites for the different AX modules like CRM, Projects etc. Then the next step was to create a document library, add some extra columns to store metadata from AX (I created columns for RecId, Company, Remarks). Then save this docu library as a template for reusability :-).









Since the plan was to have separate Sites for AX Modules and separate library for different kinds of documents within a module ( Say in CRM Module, the different types of documents required to be uploaded are case Studies, Brochures etc), I needed to create some parameter tables in AX which stored the parameters per module and per document category. See attached screens. I also had to tweak the basic docuview table and form as well as the Document handling functionality.






Then I created a C# Class library which accepts parameters and uploads the document to a specified URL, Site & Document Library and returns the URL of the attached document. See code snippet below:
======================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.IO;
using System.Net;
using Microsoft.SharePoint;
using System.Collections;

namespace DynamicsAX2009
{
public class MOSSDocumentManagement
{
public String uploadDocument(String _URL,
String _Site,
String _Library,
String _File,
String _AXID,
String _AXCompany,
String _AXRECID,
String _AXReference)
{
String sUser = "mossadmin";
String sPwd = "H@lloom24";
String sDomain = "MVP";
System.Net.NetworkCredential NC = new System.Net.NetworkCredential(sUser, sPwd, sDomain);
try
{
string SiteURL = _URL + _Site ;// "http://arijit:150/AXCRM";
String Library;
SPSite sp = new SPSite(SiteURL);
SPWeb site = sp.OpenWeb();
Library = _Library;
SPFolder folder = site.GetFolder(Library);//Case Studies ; Solution Brief
SPFileCollection files = folder.Files;
FileStream fStream = File.OpenRead(_File); //path of the file to upload
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
Hashtable MetaDataTable = new Hashtable();
MetaDataTable.Add("AX-ID", _AXID);
MetaDataTable.Add("AX-Company", _AXCompany);
MetaDataTable.Add("AX-RECID", _AXRECID);
MetaDataTable.Add("AX-Reference", _AXReference);
_File = _File.Substring(_File.LastIndexOf("\\") + 1);

SPFile currentFile = files.Add(_File, contents, MetaDataTable, true);

if (currentFile.CheckOutStatus != SPFile.SPCheckOutStatus.None)
{
currentFile.CheckIn("New Version from AX");
}

return SiteURL + "/" + currentFile.ToString();
}
catch (Exception err)
{
return ("
" + err.Message);
}
}
}
}

======================================================



Then I deployed the dll in the \Client\Bin folder of the AX Client and added as a reference. Then write a few lines of code (See Project Screenshot) in the base AX Document Handling Functionality (Forms\DocuView) which let users upload documents into MOSS Site Library and store the URL in AX :-). Pretty kewl. However security remains still a challenge. I was hoping to use the Target Audience features of MOSS for Record level Secirity but didnt have time enuff :(.











Attaching a small video. Lemme know if anyone has any suggestions.













Uploading the video . Click on link below:





HAPPY DAX-ing :-)


Источник: http://daxguy.blogspot.com/2009/01/a...-moss-wss.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Arijit Basu: AX 2009 :Cubes & Security Documentation Blog bot DAX Blogs 0 23.01.2009 01:07
Arijit Basu: Installing AX 2009 Reporting Extensions in MSSQL 2008 & WIN 2008 Blog bot DAX Blogs 0 27.12.2008 17:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Arijit Basu: AX 2009 - Quick Overview Blog bot DAX Blogs 4 19.05.2008 14:47
Arijit Basu: Reporting & BI in AX: An Overview [Level 100] Blog bot DAX Blogs 0 07.01.2008 16:01

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:05.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.