我有幾個有關SharePoint網站和C#集成的問題。 我有一個SharePoint網站&我可以添加文件,視頻到這個網站。 我有這個網站的具體的UI設計。但實際上我不能添加我的UI設計裏面這個SharePoint網站(我不知道這個。我是新來的SharePoint。) 因爲我決定採取以下腳步。Sharepoint獲取所有列表數據c#
- 創建Asp.Net MVC網站並添加我的UI設計在該網站內。
- 從asp.net MVC網站訪問我的SharePoint網站。
在我的第2步我的過程應該是這樣..
2.1裏面的一些搜索框,用戶可以搜索 但在這裏所有的數據應該來自SharePoint數據(文件名,視頻的名字,我已添加)這些文件的名稱應該加載到搜索框,如谷歌搜索。
2.2當用戶選擇1個文件名並按搜索按鈕時,他應該導航到SharePoint網站。
我的SharePoint網站現在完成。我可以添加視頻搜索使用名稱的那些東西,可以做。但這個搜索部分我需要從我的asp.net MVC網站做。
那麼我應該怎麼做?
我看到SharePoint使用休息api.but我找不到好的資源。 大多數SharePoint教程都來自Visual Studio - SharePoint - SharePoint解決方案項目。
但我需要在我的Asp.Net MVC應用程序中執行此操作。
我試圖做這樣的 How to: Retrieve Lists
,但它不是成功&我使用的SharePoint 2013網絡版
編輯
本規範我tried.but不sucess.right現在我試圖將數據檢索到我的標籤或文本框。
using SP = Microsoft.SharePoint.Client;
string siteUrl = "http://SMit.sharepoint.com/MySiteName";
SP.ClientContext clientContext = new SP.ClientContext(siteUrl);
SP.Web oWebsite = clientContext.Web;
SP.ListCollection collList = oWebsite.Lists;
clientContext.Load(collList);
clientContext.ExecuteQuery();
foreach (SP.List oList in collList)
{
label1.Text = label1.Text + ", " + oList.Title +""+ oList.Created.ToString();
//Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created.ToString());
}
繼方法還我試圖
string siteUrl = "http://SMit.sharepoint.com/MySiteName";
using (SP.ClientContext spcontext = new SP.ClientContext(siteUrl))
{
spcontext.AuthenticationMode = SP.ClientAuthenticationMode.FormsAuthentication;
spcontext.FormsAuthenticationLoginInfo = new SP.FormsAuthenticationLoginInfo("[email protected]", "password");
spcontext.Load(spcontext.Web, w => w.Title, w => w.ServerRelativeUrl, w => w.Lists);
spcontext.ExecuteQuery();
//Console.WriteLine(spcontext.Web.ServerRelativeUrl);
//I haven done anything here.i want to check spcontext.ExecuteQuery(); works or //not.
}
,但現在我得到以下類似的錯誤。 錯誤發生在 spcontext.ExecuteQuery();
Microsoft.SharePoint.Client.Runtime.dll中發生未處理的類型爲「Microsoft.SharePoint.Client.ServerException」的異常 其他信息:用戶的登錄名或密碼無效。
你應該發佈你已經使用過的代碼,以什麼方式不起作用。否則沒有人會知道爲什麼它不工作 – Bassie
我沒有更新我的問題,但我已經添加了該網址。但那一個是基本的。我想我也應該給認證。 – TDM
你有沒有得到任何錯誤? – Bassie