Hello,
Using Visual Studio 2019.
I need to connect to one of our Office 365 Sharepoint Sites and have the ability to simply add files via code.
I am ONLY connect to the remote sharepoint site and do not have sharepoint server running on my Windows 10 OS.
I get an error on the very first step which is:
From what I have seen I needed to have the Microsoft.Sharepoint dll so I used the Manage Nuget Packages and installed:
I have verified the file, the version and everything exists.
So I then used the Fuslogvw.exe tool to try and find what assemblies are not loading.
So found an entry saying it could not find Microsoft.SharePoint.Security.DLL.
I then used Nuget to download that to the solution and built/ran again.
This time fails again, but now says it could not find Microsoft.SharePoint.intl.
I am searching in Nuget again and not finding this.
So at this point I am at a loss as to what to do.
Do I have to have sharepoint itself installed on the local dev unit???
One... am I even using the correct commands to connect to the site and work with the library and so forth.
There are a lot of other nuget sharepoint type of packages, but now I am just guessing at what may be needed.
Thanks in advance for your help!
Using Visual Studio 2019.
I need to connect to one of our Office 365 Sharepoint Sites and have the ability to simply add files via code.
I am ONLY connect to the remote sharepoint site and do not have sharepoint server running on my Windows 10 OS.
I get an error on the very first step which is:
Connect to Sharepoint SIte:
private void button1_Click(object sender, EventArgs e)
{
//Retrive sitecollection
// Get Errors when this runs
using (SPSite site = new SPSite("https://xxxxx.sharepoint.com/sites/sitename"))
{
//Open Web
using (SPWeb web = site.OpenWeb())
{
MessageBox.Show(web.Description, "Title");
//get library named "Documents"
SPList DocLib = web.Lists["DVBCI"];
}
}
}
From what I have seen I needed to have the Microsoft.Sharepoint dll so I used the Manage Nuget Packages and installed:
- Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.SharePoint.Library, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
Source=Microsoft.SharePoint
StackTrace:
at Microsoft.SharePoint.CoreResource.GetString(ResourceGroup rg, String name, Object[] values)
at Microsoft.SharePoint.SPSite.LookupSiteInfo(SPFarm farm, Boolean contextSite, Boolean swapSchemeForPathBasedSites, Uri& requestUri, Boolean& lookupRequiredContext, Guid& applicationId, Guid& contentDatabaseId, Guid& siteId, Guid& siteSubscriptionId, SPUrlZone& zone, String& serverRelativeUrl, Boolean& hostHeaderIsSiteName, Boolean& appWebRequest, String& appHostHeaderRedirectDomain, String& appSiteDomainPrefix, String& subscriptionName, String& appSiteDomainId, Uri& primaryUri)
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, Boolean swapSchemeForPathBasedSites, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
at DocVaultTransfer.Form1.button1_Click(Object sender, EventArgs e) in C:\VS2019\Repo\DocVaultTransfer\Form1.cs:line 27
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at DocVaultTransfer.Program.Main() in C:\VS2019\Repo\DocVaultTransfer\Program.cs:line 19
I have verified the file, the version and everything exists.
So I then used the Fuslogvw.exe tool to try and find what assemblies are not loading.
So found an entry saying it could not find Microsoft.SharePoint.Security.DLL.
I then used Nuget to download that to the solution and built/ran again.
This time fails again, but now says it could not find Microsoft.SharePoint.intl.
I am searching in Nuget again and not finding this.
So at this point I am at a loss as to what to do.
Do I have to have sharepoint itself installed on the local dev unit???
One... am I even using the correct commands to connect to the site and work with the library and so forth.
There are a lot of other nuget sharepoint type of packages, but now I am just guessing at what may be needed.
Thanks in advance for your help!