简体   繁体   English

从Sharepoint文件夹访问Excel文件

[英]To access an Excel file from a Sharepoint Folder

I am using the below code, to open the Excel file from SharePoint. 我正在使用以下代码,从SharePoint中打开Excel文件。

I am Little confused how, I should code, for the accessing the file from an Folder in SharePoint. 我有点困惑,我应该如何编码,以便从SharePoint中的文件夹访问文件。

The Excel file, i Need is stored in ; Excel文件i Need存储在中; SharePoint>> Document >> Test >> Data >>July SharePoint >>文件>>测试>>数据>>七月

and the link to my SharePoint is like this, https://forum/content/008200/default.aspx?RootFolder=%2Fcontent%2F00008200%20Documents%2DTest%2F0001%20%29&FolderCTID=0x01200083BC38D90EC5674491B520CC48282737&View= {00112127-0FE6-44A4-A5FB-86BC6C4E835B}&InitialTabId=Ribbon%2EDocument&VisibilityContext=WSSTabPersistence 并且指向我的SharePoint的链接是这样的, https://forum/content/008200/default.aspx?RootFolder =%2Fcontent%2F00008200%20Documents%2DTest%2F0001%20%29&FolderCTID = 0x01200083BC38D90EC5674491B520CC48282737&View = {00112127-0FE6-44A4- A5FB-86BC6C4E835B}&InitialTabId =丝带%2EDocument&VisibilityContext = WSSTabPersistence

Could someone help me, How i should code, to acess an Excel file from a Folder in SharePoint. 有人可以帮助我,我应该如何编码,以从SharePoint中的文件夹访问Excel文件。

I have attached a Piece of code, which i reffered it from the Forum. 我已经附上了一段代码,这是我在论坛中推荐的。 and would be helpful, if you could comment the lines, if you can suggest me a code. 如果您可以对各行进行注释,以及可以向我推荐代码,这将对您有所帮助。

Sub Share()
Dim SWB As Workbook
Dim WB As Variant

With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "https://forum/Content/008200/default.aspx" & "\"
.AllowMultiSelect = False
.show

For Each WB In .SelectedItems
Set SWB = Workbooks.Open(WB)
Next
End With

If SWB Is Nothing Then Exit Sub

End Sub

i don't know , how can you with vb but i assume your file in Document Library if it is you can use this code to get document. 我不知道,用vb怎么办,但是我认为如果在文档库中,则可以使用此代码获取文档。

SPFile myExcelFile = SPContext.Current.Web.GetFile("/Documents/Test/Data/July/excelFile.xslx"); 
Stream excelFileStream = myExcelFile.OpenBinaryStream();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM