Accessing document stored into SharePoint 2010

racineconde
racineconde used Ask the Experts™
on
I've setup a sharepoint site and created a document library.

I have uploaded some documents onto the document library and need now to access those files through using the .Net framework 4.0 and C# as the programming language.

Any help much appreciated!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Where can I find the required dll? I am not able to find them either on my sharepoint server or when trying to add a reference in VS 2010
Anurag AgarwalPython Developer

Commented:
add following namespaces in your code
Microsoft.SharePoint and Microsoft.SharePoint.Utilities
 
Anurag
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Author

Commented:
for the reference to work you need the actual dll on your dev machine: Microsoft.SharePoint.dll for example.
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI

this is the Microsoft.Sharepoint.dll path. you can add to VS 2010 reference.

Author

Commented:
I don't have any ISAPI folder under 12. Is there something I need to install???
ISAPI is in sharepoint server.

Author

Commented:
Referencing the dlls and adding using reference seems not to work. For some reasons VS 2010 seems not to be able to recognize the references.

I have attached a screen shot to show the errors.
SharePoint-Reference.jpg

Author

Commented:
This does not fix the problem. Here are the warnings that I get and I think it explains the error I am getting:
*******************************************************************************
The referenced assembly "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

The referenced assembly "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
*************************************************************************************

I have 10 warnings similar but they all seem to point out that the problem is that I am targetting .NET Framework 4.0!!!

Problem is that's my Dev Environment. I can't move back to the previous versions of .NET!!!
sharepoint which version you are useing.

if you use sharepoint 2010 -> C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\ISAPI

vs 2010

if you use sharepoint 2007 -> C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI

vs 2008 and 2005

Are you accessing the file locally on the server?  If not I would suggest using web services...

http://msdn.microsoft.com/en-us/library/ee705814.aspx
ya you can change project properties application -> target frame work drop down to .net framework 3.5.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial