none
console application sharepoint 0ffice365 site url

    질문

  • Hi,

    I have used .net console application and using office 365 sharepoint site url but we are getting below error while running the application

    Error code: 503 service unavailable



    Blitz


    • 편집됨 sree_23 2018년 5월 20일 일요일 오후 3:14
    2018년 5월 17일 목요일 오후 2:06

답변

  • Hi Sree,

    Since you can connect the site in Browser, so the site has no problem. But in Console Application, you can try my solution above to connect the site to see if it works.

    This is the valid solution to connect SPO Site in Console Application.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • 답변으로 표시됨 sree_23 2018년 5월 18일 금요일 오전 9:05
    2018년 5월 18일 금요일 오전 8:49

모든 응답

  • Hi Sree,

    Please download Microsoft.SharePointOnline.CSOM from Nuget:

     And then in Console Application Program.cs run the code snippet below:

    using Microsoft.SharePoint.Client;
    using System;
    using System.Security;
    
    namespace ConsoleApp5
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                string userName = "xxx@xxx.onmicrosoft.com";
                string password = "xxxx";
                var securePassword = new SecureString();
                foreach (char c in password)
                {
                    securePassword.AppendChar(c);
                }
                using (var clientContext = new ClientContext("https://xxx.sharepoint.com/sites/xxx"))
                {
                    clientContext.Credentials = new SharePointOnlineCredentials(userName, securePassword);
                    Web web = clientContext.Web;
                    clientContext.Load(web, a => a.Title);
                    clientContext.ExecuteQuery();
                    Console.WriteLine(web.Title);
                }
            }
        }
    }
    

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 18일 금요일 오전 5:29
  • Is it the solution for the 503:service unavailable error

    Blitz

    2018년 5월 18일 금요일 오전 8:45
  • Hi Sree,

    Since you can connect the site in Browser, so the site has no problem. But in Console Application, you can try my solution above to connect the site to see if it works.

    This is the valid solution to connect SPO Site in Console Application.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • 답변으로 표시됨 sree_23 2018년 5월 18일 금요일 오전 9:05
    2018년 5월 18일 금요일 오전 8:49
  • Hi Sree,

    For 503 Service Unavailable Error, it means the site is blocking the site due to the Thottling limitation:

    And this is consider to do if getting blocking due to Throttling Limitation in SharePoint Online:

    For more detailed information, please refer the Official Guide below:

    Avoid getting throttled or blocked in SharePoint Online

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 18일 금요일 오전 9:06