SpproFrameWork Migrate

Michael edited this page Jul 10, 2017 · 2 revisions

Connect to SharePoint

Choose SharePoint Lists & fields to create .cs Entity

Choose Namespace, Context Class Name and Project Location (.cs files are created)

Save your SP Entity Project so you can update the Model should you add/update any lists

Include the files into your projects.

Start accessing your lists via Strongly Typed C#

        SecureString password = FetchPasswordFromConsole(); //Create Secure String Password
        using (var context = new ClientContext(webSPOUrl))  //Create Client Context using Shaerpoint URL
            context.Credentials = new SharePointOnlineCredentials(userName, password);  //Use Credentials
            SpContext SpoContext = new SpContext(context); //Sp Context. Class Named via the SpproFramework GUI
            var property = SpContext.Properties.Query("Id=3")[0];  //Get First entity with ID = 3, Any field can be used to query
            property.Description = "My House"; //Update the Entity Property
            SpContext.UpdateOrCreate(property); //Save Change back to SharePoint
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.