1

I am trying to develop my first SharePoint App. I have a Development Environment on Azure and Visual Studio 2013.

Then i create my app project by using the default Visual Studio 2013 (it's the same on Visual Studio 2012 i think) SharePoint App Template by going to

Click File -> New -> Project and choose App for SharePoint 2013

Then i choose Autohosted and select the sharepoint site i want to use for debug. Everything works fine.

Since this templates are supposed to run out of box, i press f5 for deubug. At first all seems well. Connection to Sharepoint is correctly made and i am presented with the following screen:

SharePoint App Permissions

I press "Trust It" Option and i get the following screen:

Unknown User

I should be getting something like

enter image description here

I don't get this. If i have so much problems debugging the default sharepoint app imagine when i have to get to serious development... I am starting to get nervous about using SharePoint Apps. Does anyone is successfully eveloping apps?

EDIT:

After making some debug i found out the following:

On SharePointContextFilterAttribute.cs it always falls on:

RedirectionStatus.CanNotRedirect:
                    filterContext.Result = new ViewResult { ViewName = "Error" };
                    break;

If i drilled down a bit and i found out that before this, when it doesn't find a SharePoint Context it tries to create one and it fails here:

 string spAppWebUrlString = TokenHelper.EnsureTrailingSlash(httpRequest.QueryString[SharePointContext.SPAppWebUrlKey]);

There is no key for SPAppWebURL on httpRequest... Don't now why or even if this is supposed to.

Then, after this fails, it falls on SharePointContext.cs CheckRedirectStatus() method:

if (StringComparer.OrdinalIgnoreCase.Equals(httpContext.Request.HttpMethod, "POST"))
            {
                return RedirectionStatus.CanNotRedirect;
            }

It's really easy to replicate and test this. Just create a Developer Site and create a new SharePoint App Project (MVC or WebPages it doesn't matter since you are not changing any code).

After that just press f5 and test it against our SharePoint developer site. It is allegedly really easy to start...

2
  • I can see you have affiliated a MVC project to your app. Have you tried testing the app without the MVC project to see if the App works OOTB?
    – user2536
    Dec 16, 2013 at 9:23
  • I also tried WebPages App. It doesn't show this Unknown User Error but it still gives an error. Something like there was an error. By Debbugging i can see that it is the same. I will edit my question with what i found on debug..
    – Fonsini
    Dec 16, 2013 at 9:28

1 Answer 1

2

Found out the problem.

I was making quite a few mistakes:

  1. Creating a Autohosted App:

    • For this you need to debug your app on Sharepoint Online
    • If you have your own SharePoint instalation it won't work
  2. Provider-Hosted App

    • You need a few pre-requisites to use this one.
    • You need to create a high-trust app for SP2013 and generate the appropriate certificates. Here's How

How to: Create high-trust apps for SharePoint 2013 using the server-to-server protocol (advanced topic)

Hope this helps others that are starting on app development as i am.

1
  • Hi - sorry I couldn't help you more when you asked me about this before. It's a really annoying error, because it's misleading. A good start is to switch on the proper ASP.Net error page for remote machines: jcardy.co.uk/… Mar 3, 2014 at 10:55

Your Answer

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

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