Opening Sharepoint documents for Edit from NAV2013

KjeldLober
Member Posts: 2
Hi,
Is there anybody who had tried to open a Sharepoint Document from NAV 2013 using .net components. ?
The ActiveX component “SharePoint.OpenDocuments” is used to open SharePoint documents ready for editing.
If you hyperlink then DocumentURL it will open, but it will always be opened read-only.
I have tried to "recode":
The following code will create an version specific instance of SharePoint.OpenDocuments and then call the EditDocument method to open the document:
.net:
public static void OpenDocumentForEdit(string docUrl)
{
Type t = null;
// get the correct version specific version...
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.1");
if (t == null)
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.2");
if (t == null)
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.3");
if (t == null)
{
System.Diagnostics.Process.Start(docUrl);
// best we can do, will open read-only
return;
}
Object o = Activator.CreateInstance(t);
object[] openParms = { docUrl, string.Empty };
t.InvokeMember("EditDocument",System.Reflection.BindingFlags.InvokeMethod |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance,null, o, openParms);
}
NAV2013:
Var:
type DotNet System.Type.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
obj DotNet System.Object.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
openParm DotNet System.Object.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
nullBinder DotNet System.Reflection.Binder.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
systemActivator DotNet System.Activator.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
parmstr Text 1024
Param Text 1024
EditDocument(URL)
openParm := openParm.Object;
openParm.ReferenceEquals(URL,'');
bindingFlags1 := 276;
parmstr := '';
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.1');
IF ISNULL(type) THEN
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.2');
IF ISNULL(type) THEN
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.3');
IF ISNULL(type) THEN
HYPERLINK(URL);
obj := systemActivator.CreateInstance(type);
type.InvokeMember('EditDocument', bindingFlags1, nullBinder ,obj, openParm);
Any ideas?
Is there anybody who had tried to open a Sharepoint Document from NAV 2013 using .net components. ?
The ActiveX component “SharePoint.OpenDocuments” is used to open SharePoint documents ready for editing.
If you hyperlink then DocumentURL it will open, but it will always be opened read-only.
I have tried to "recode":
The following code will create an version specific instance of SharePoint.OpenDocuments and then call the EditDocument method to open the document:
.net:
public static void OpenDocumentForEdit(string docUrl)
{
Type t = null;
// get the correct version specific version...
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.1");
if (t == null)
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.2");
if (t == null)
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.3");
if (t == null)
{
System.Diagnostics.Process.Start(docUrl);
// best we can do, will open read-only
return;
}
Object o = Activator.CreateInstance(t);
object[] openParms = { docUrl, string.Empty };
t.InvokeMember("EditDocument",System.Reflection.BindingFlags.InvokeMethod |
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance,null, o, openParms);
}
NAV2013:
Var:
type DotNet System.Type.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
obj DotNet System.Object.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
openParm DotNet System.Object.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
nullBinder DotNet System.Reflection.Binder.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
systemActivator DotNet System.Activator.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
parmstr Text 1024
Param Text 1024
EditDocument(URL)
openParm := openParm.Object;
openParm.ReferenceEquals(URL,'');
bindingFlags1 := 276;
parmstr := '';
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.1');
IF ISNULL(type) THEN
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.2');
IF ISNULL(type) THEN
type := type.GetTypeFromProgID('SharePoint.OpenDocuments.3');
IF ISNULL(type) THEN
HYPERLINK(URL);
obj := systemActivator.CreateInstance(type);
type.InvokeMember('EditDocument', bindingFlags1, nullBinder ,obj, openParm);
Any ideas?
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions