上传DOCX,DOC和PDF文件从原生的Andr​​oid应用程序,网上的SharePoint [英] uploading docx,doc and pdf file to sharepoint online from native android app

查看:216
本文介绍了上传DOCX,DOC和PDF文件从原生的Andr​​oid应用程序,网上的SharePoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序来远程访问SharePoint online.I我能够使用HTTP PUT方法上载文件,并查看他们,但我不能够打开them.I觉得我没有指定适当的内容type.Here的我code:

I am developing an android app to remotely access sharepoint online.I am able to upload files using http put method and view them but i am not able to open them.I feel i am not specifying the proper content type.Here's my code:

try {       
    File sdcard = Environment.getExternalStorageDirectory();

    //Get the text file
    File file = new File(sdcard, "gps.doc");

    FileInputStream fIn = new FileInputStream(file);
    BufferedReader myReader = new BufferedReader(
            new InputStreamReader(fIn));
    String aDataRow = "";
    String aBuffer = "";
    while ((aDataRow = myReader.readLine()) != null) {
        aBuffer += aDataRow + "\n";
    }

    System.out.println(aBuffer + "content of the file");

    HttpPut httpupld = new HttpPut("http://mysite.sharepoint.com/Sites/Documents/gps.doc");


    StringEntity entity1 = new StringEntity(aBuffer, "HTTP.UTF_8");
    httpDel.setEntity(entity1);


    System.out.println(title);
    HttpResponse rsp = http2.execute(httpupld);
    respcode=rsp.getStatusLine().getStatusCode();
    System.out.println(respcode);

} catch (Exception e) {
    Log.e("Error: ", e.getMessage());
}

任何帮助是AP preciated.Thankyou

Any help is appreciated.Thankyou

推荐答案

您无法打开(但鉴于)文档在Office Web Apps无论是在SharePoint Online中,或者如果您有它安装导通premises。

You can't open (but view) doc in Office Web Apps either on SharePoint Online or if you have it installed on-premises.

在上传之前2007/2010标准,将您的办公文档到办公室,这是DOCX,XLSX,PPTX ..​​.

Convert your office documents to the office 2007/2010 standards before uploading them, that's docx, xlsx, pptx ...

这篇关于上传DOCX,DOC和PDF文件从原生的Andr​​oid应用程序,网上的SharePoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆