SharePoint OpenDocument无法打开PDF或TXT文件 [英] SharePoint OpenDocument not Opening PDF or TXT Files
问题描述
我正在使用以下方法在SharePoint中打开文档进行编辑...
I am using following method to open a document in SharePoint for editing...
此方法在Word文档上效果很好,但无法打开PDF文档或TXT文件
This method works fine on Word documents but it will not open a PDF documents or TXT file
```
公共静态无效OpenDocumentForEdit(string docUrl)
{
输入t = null;
//获取正确的版本特定版本...
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.1");
如果(t == null)
{
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.2");
}
如果(t == null)
{
t = Type.GetTypeFromProgID("SharePoint.OpenDocuments.3");
}
如果(t == null)
{
System.Diagnostics.Process.Start(docUrl); //我们会尽力而为,将以只读方式打开
返回;
}
对象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);
}
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);
}
```
-d.
推荐答案
程序运行时是否有任何错误消息?
Is there any error message when the program running?
您是否尝试通过指定如下所示的应用程序来打开文件?
Did your try to open the file by specifying the application like below?
System.Diagnostics.Process.Start("notepad.exe", "http://..../a.txt");
最诚挚的问候,
刘李
这篇关于SharePoint OpenDocument无法打开PDF或TXT文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!