none
Connect SharePoint Online from VB.NET 2015 Windows App RRS feed

  • Question

  • Hi..

    I would like to know the connection string for sharepoint Online. 

    Windows Form may prompt for the user login.

    View/update/Delete as well

    Thank You,

    Supun

    Tuesday, February 21, 2017 8:34 PM

Answers

  • Hi,

    Please login the SharePoint Online site using admin, then go to Site settings->Site permissions->Check permissions.

    Best Regards,

    Dennis


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

    • Marked as answer by Supun151515 Saturday, February 25, 2017 7:16 PM
    Thursday, February 23, 2017 7:48 AM
    Moderator

All replies

  • Hi Supun,

    We can use .NET Client Object Model to access SharePoint Online content and use SharePointOnlineCredentials to achieve the authentication.

    Here is an example about how to add a list item to a custom list in SharePoint online for your reference:

    Imports Microsoft.SharePoint.Client
    Imports System.Security
    Public Class Form1
       Dim siteUrl As String = "YourSiteURL"
        Dim context As New ClientContext(SiteUrl)
        Dim web As Web
        Dim userName As String = "UserName"
        Dim password As String = "Password"
        Dim secureString As New SecureString
    
    
        Private Sub bt_connect_Click(sender As Object, e As EventArgs) Handles bt_connect.Click
    
            For Each c As Char In password
                secureString.AppendChar(c)
            Next
            context.Credentials = New SharePointOnlineCredentials(userName, secureString)
            Try
                web = context.Web
                context.Load(web)
                context.ExecuteQuery()
                Dim oDocLib As List
                oDocLib = context.Web.Lists.GetByTitle("BruceList")
                Dim itemCreateInfo As New ListItemCreationInformation
                Dim oListItem As ListItem
                oListItem = oDocLib.AddItem(itemCreateInfo)
                oListItem("Title") = "My New Item!12345"
                oListItem.Update()
                context.ExecuteQuery()
            Catch ex As Exception
                Console.WriteLine(ex.Message)
            End Try
        End Sub
    End Class
    

    More information:

    Complete basic operations using SharePoint 2013 client library code

    https://msdn.microsoft.com/en-us/library/office/fp179912.aspx

    Best Regards,

    Dennis


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

    Wednesday, February 22, 2017 8:30 AM
    Moderator
  • Hi Dennis,

    Thank you for your reply. I have tried your code and it is getting ex.Message  "The Login server cannot issue the requested compact encrypted ticket because a Data Encryption Key (DEK) has not been uploaded to the site."

    Kindly reply with the reason for that

    Thank You,

    Supun

    Wednesday, February 22, 2017 2:14 PM
  • Hi Supun,

    Please make sure your account can access SharePoint Online, or please try to use a SharePoint site admin to check if it works.

    Best Regards,

    Dennis


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

    Thursday, February 23, 2017 1:26 AM
    Moderator
  • Hi Dennis,

    I am accessing SharePoint Online. But how can I verify that my account has permission to access online SharePoint.

    Thank You,

    Supun

    Thursday, February 23, 2017 4:04 AM
  • Hi,

    Please login the SharePoint Online site using admin, then go to Site settings->Site permissions->Check permissions.

    Best Regards,

    Dennis


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

    • Marked as answer by Supun151515 Saturday, February 25, 2017 7:16 PM
    Thursday, February 23, 2017 7:48 AM
    Moderator