2

I have a problem with asp.net project, I can't acces to my sharepoint site, I have a error message when I do :

using (SPSite site = new SPSite("http://<SharePoint_Site_URL>"))

So I'm asking if it is possible to have in the same solution two type of project : asp.net project and sharepoint project. From the asp project I can call some methodes in the sharepoint project (getFile) that give me the file I need in a specific library of my sharepoint site, and after do some modifications to this file in my asp project and after call another methode in my sharepoint project (updateItem) to update my file.

Note that I'm working directly in the sharepoint server.

Thanks in advance

1
  • Robert's answer is the correct one, but are you sure you need a separate application? Perhaps you could create a custom web part or application page instead?
    – Mike2500
    Commented Jun 16, 2014 at 18:32

2 Answers 2

3

Your asp.net application would need to use the client API for SharePoint (aka CSOM), you can think of it like a provider hosted app in 2013 (but without the app web)

Here is a great starting point for CSOM: http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx

5
  • but I'm using sharepoint 2010. Is that possible in 2010
    – user29701
    Commented Jun 16, 2014 at 18:46
  • Hi and thanks for your reply; I'm using Sharepoint 2010 and as I see that CSOM is too limited. what I really need is to have a methode that can get a form of infopath(xml) as an xmldocument and work with it in my asp project and after update it in my sharepoint library. I think I really need to use this two project in the same solution unfortunatlly, is that possible?? and if yes how can I do it?? Thanks in advance
    – user29701
    Commented Jun 16, 2014 at 18:57
  • You will only be able to use client object model in an asp.net application. Otherwise you would have to work on SharePoint, creating Webparts and / or application pages directly in SharePoint. That way you will be able to use the more (for 2010 at least) complete server side object mode Commented Jun 16, 2014 at 19:35
  • the problem is that SharePoint project does not support .NET 4.0 ! it only support .Net 3.5 . that's why my solution work fine in ASP.NET and not in SharePoint Project. Is there any solution to SharePoint Project support .NET 4.0 ?–
    – user29701
    Commented Jun 17, 2014 at 8:26
  • SharePoint 2013 support .Net 4.5, 2010 is in .Net 3.5, so your only solution there is to either upgrade Sharepoint to 2013 or downgrade your ASP.Net app Commented Jun 17, 2014 at 8:28
0

If the ASP.NET site is running on the same server as SharePoint then that code should work - provided that the ASP.NET site is running under an application pool with a user that has credentials to access the SharePoint site you're trying to connect to. You only need CSOM if the ASP.NET site needs to be able to work on a server that isn't part of the SharePoint farm (and even then you'd need to deal with credentials/authentication). What's the actual error you get?

2
  • the problem is that does not support .NET 4.0 ! it only support 3.5 . that's why my solution work fine in ASP.NET and not in SharePoint Project. Is there any solution to SharePoint Project support .NET 4.0 ?
    – user29701
    Commented Jun 17, 2014 at 7:14
  • Yes, but only if it's SharePoint 2013 sorry! Other than that, no, if you want to support SharePoint 2010 it must be called from a .NET 3.5 AppDomain. In principle you could start up a separate .NET 3.5 executable to do the work, but I'm not sure it's worth it. Commented Jun 17, 2014 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.