SharePoint Online CSOM GetChanges

Hi,
I can't seem to find answer to simple question,so could anyone please help with this:
In current (v15/16) SharePoint Online, can I use CSOM to get list of changes on list/site using GetChanges API call (http://msdn.microsoft.com/en-us/library/ms461643(v=office.14).aspx). 
Thanks!

http://msdn.microsoft.com/en-us/library/office/gg454742%28v=office.14%29.aspx
http://msdn.microsoft.com/en-us/library/office/ee537247%28v=office.14%29.aspx
GetChanges  is also available for V15 \ sharepoint online
http://msdn.microsoft.com/en-us/library/ms461643(v=office.15).aspx
Try to use below code:
lientContext context = new ClientContext("http://SPSite");
context.Credentials = new NetworkCredential("user", "pwd", "domain");
ChangeQuery cq = new ChangeQuery(true, true);
cq.ChangeTokenStart = new ChangeToken();
cq.ChangeTokenStart.StringValue = "1;3;" + list.Id.ToString() + ";" + DateTime.UtcNow.AddHours(-1).Ticks.ToString() + ";-1";
ChangeCollection col = list.GetChanges(cq);
context.Load(col);
context.ExecuteQuery();
MessageBox.Show(col.Count.ToString());
http://webcache.googleusercontent.com/search?q=cache:HfqYOemJ780J:morshemesh.blogspot.com/2010/12/retrieving-items-changedaddeddeleted.html+&cd=8&hl=en&ct=clnk&gl=in&client=firefox-a

Similar Messages

  • Office365 - SharePoint Online - CSOM Limits

    Hi,
    Anyone know if there are any throttling limits on the SharePoint Online JSOM api in Office365? Sometimes we get a time-out with a request and a few days/hours later the problem is solved.
    The specific error we get is a Microsoft.SharePoint.Client.ClientServiceTimeoutException
    Kind Regards,
    Ludwig

    Hi Steve,<o:p></o:p>
    I'm a colleague of Ludwig, and I also involved into this issue.<o:p></o:p>
    Just to be clear the throttling limit, is this specific to the JSOM endpoint or the whole frontend? Because what we experience is that
    we get timeouts for some JSOM requests (not particularly the same request). We also do not notice any pattern in the timeouts, they are randomly and the timeouts keep occurring for
    a couple of hours and in some cases days. Although we do not have other issues, with the environment like pages that timeout, or other connections that are terminated.
    Toon
    <o:p></o:p>

  • SharePoint Online Authentication using LiveId

    Good evening.
    I'm trying to use client side object model to perform operation on a SharePoint Online site.
    using (var context = new ClientContext("https://xxxx.sharepoint.com/sites/xxxx"))
    var passWord = new SecureString();
    foreach (var c in "xxxxx.1") passWord.AppendChar(c);
    context.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);
    var web = context.Web;
    var newFile = new FileCreationInformation { Content = System.IO.File.ReadAllBytes(fileName), Url = Guid.NewGuid().ToString() + Path.GetExtension(fileName) };
    var docs = web.Lists.GetByTitle("Documents");
    docs.RootFolder.Files.Add(newFile);
    context.ExecuteQuery();
    Console.WriteLine(newFile.Url);
    Well, this code works fine if I use federated user or email address like [email protected]
    But I want to use CSOM using a LiveId that already has been invited on this site.
    Any ideas?
    Thanks,
    Sergio
    Regards,
    Bubu
    http://zsvipullo.blogspot.it
    Please mark my answer if it helped you, I would greatly appreciate it.

    Hi Sergio Russo,
    I haven’t seen samples to call SharePoint online CSOM with external user account, the following article shows how active authentication works in Office 365 SharePoint online:
    http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx
    For this issue, please in the Office 365 SharePoint online forum would be more professional on this, please go to that forum for more information:
    http://community.office365.com/en-us/f/default.aspx
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Authentication with SharePoint Online

    Hi
    I have a win32 C++ application which is able, using NTLM authentication, to call the different SharePoint web services (lists, copy, etc) in a local SharePoint installation. This is done by building XML SOAP requests at runtime and HTTP posting.
    This approach does not work with SharePoint Online and I was wondering if it was possible to make the existing code work without a total rewrite.
    I have experience with OAuth 2 as I have previously integrated to OneDrive, Google Drive, Dropbox etc. using their REST web service api.
    Is it also possible to use OAuth 2 with SharePoint Online and the web services in a similar fashion? Have refresh tokens and exchanging them for access tokens which are sent to server in post.
    I have tried playing around with it, creating an app in the Microsoft Seller Dashboard and tried using client id with OAuthAuthorize.aspx, but getting error 'The clientId 'xxx'
    is not a valid service identity.". No idea what that means.
    Am I going the wrong way and can someone point me in the right direction?
    Thanks!

    Hi,
    In order to access SharePoint Online via REST API, we can use SharePointOnlineCredentials object to pass the authentication.
    Here’s a code sample that connects to the REST API:
    var creds = new SharePointOnlineCredentials(SPO_USERNAME, StringUtilities.ToSecureString(SPO_PASSWORD));
    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(SPO_URL + "/_api/web/lists");
    request.Credentials = creds;
    request.Method = "GET";
    request.Accept = "application/json;odata=verbose";
    request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED: f");
    var response = (HttpWebResponse)request.GetResponse();
    using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
    Console.WriteLine(reader.ReadToEnd());
    More information:
    http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.sharepointonlinecredentials(v=office.15).aspx
    http://sharepointtaproom.com/2014/01/23/connecting-to-sharepoint-onlines-csom-or-rest-apis-from-sharepoint-2010/
    http://sergeluca.wordpress.com/2009/08/31/calling-sharepoint-dlls-from-c-code/
    Best regards
    Dennis Guo
    TechNet Community Support

  • Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?

    Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?
    change in sharepoint scripts not require compilation but anything else?

    Yes, PowerShell is great, since you can quick change your code without compilation.
    SP admin can write ps scripts without specific tools like Visual Studio.
    With powershell you can use cmdlets,
    which could remove a lot of code, for example restarting a service.
    [custom.development]

  • Security flaw-To use CSOM/Javascript code for Custom Office365(Sharepoint Online) application

    Hi,
    I've developed custom application in Office365(Sharepoint Online) using CSOM/Javascript. Security team from client side has been reported one major issue to the our application that any end user can comment our CSOM/Javascript code and bypass the validation
     or can update / insert into sharepoint list item using developer tool/ Console in Google Chrome(F12 Key).
    Also end user can write his own separate code in console of Google Chrome (Developer Tool / F12) and can update / insert  into Sharepoint List.
    Note:- End user has Add, Edit, View permission on all Sharepoint List.
    This is one major security flaw of the Sharepoint/Office365 to use CSOM /Javascript for writing code, to overcome this issue could you please provide me some solution.
    Your help would be greatly appreciated!!!  
    Looking for reply.
    Thanks,
    Mahesh Sherkar
    Web: http://Mahesh-Sherkar.com
    Email: [email protected]

    Hello Paras, 
    Did you get any solution for this? I think your website was implemented this form. Can you please tell me the way how I can achieve it? I am also facing same problem. Please reply me as early as possible.
    Thanks,
    Mihir

  • Managing Query Suggestions through CSOM (C#) or PowerShell for Sharepoint Online.

    Hello everybody.
    I am currently working with Sharepoint Online search and am trying to find information about managing Query suggestions (CRUD operations).
    Would anybody have any information as to how I could do this in CSOM or PowerShell ? I truely am having a hard time on this.

    Hi,
    Please check below. This should help you. You can REST APIs
    Retrieving query suggestions using the Search REST service
    https://msdn.microsoft.com/en-us/library/office/dn194079.aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to make intellisense enable in powershell in CSOM for sharepoint online?

    how to make intellisense enable in powershell in CSOM for sharepoint online?
    I am loading assembly  as following
    [Reflection.Assembly]::LoadFrom("$scriptdir\Microsoft.SharePoint.Client.dll")        
     [Reflection.Assembly]::LoadFrom("$scriptdir\Microsoft.SharePoint.Client.Runtime.dll")

    Hi,
    try this
    http://powerguivsx.codeplex.com/
    http://mackenzie-sharepoint.blogspot.com/2011/12/sharepoint-2010-powershell-intellisense.html
    https://technet.microsoft.com/en-us/library/ff461033.aspx
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/fcb85984-abf9-428a-a2a7-952cec37ea49/powershell-ise-intellisense
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • Any way to get all users's user profile proeprty using CSOM c# for sharepoint online - office 365?

    Any way to get all users's user profile proeprty using CSOM c# for sharepoint online - office 365?

    Since CSOM provides methods for operations related to people per
    user scope, you could retrieve all site users first using SP.Web.siteUsers
    property. and then use SP.UserProfiles.PeopleManager.getUserProfilePropertyFor
    Method to get property.
    [custom.development]

  • Powershell CSOM Sharepoint online list permission

    I've been writing a script to connect to SharePoint online, create a document library and add some AD accounts to the permission. I've written all the code using snippets I have found through many searches but am having an issue with the permissions part.
    All of the code is taken from this page:
    http://jeffreypaarhuis.com/2012/06/07/scripting-sharepoint-online-with-powershell-using-client-object-model/
    The only change is i'm using the get principal fun instead of the get group, but not sure if that's what has done it. I'm very new to powershell.
    I keep getting an error when adding the user and permission type to roledefinitionbinding. The error is:
    Collection has not been initialized at line 0 char 0.
    The issue is when it runs $collRoleAssign.Add($principal, $collRdb) part and stop with the error above.
    I would really appreciate a hand with this before my PC get launched out of the window.
    Thanks Mark

    Hi,
    The following code snippet for your reference:
    var login = "[email protected]";
    var password = "xxxxxx";
    var siteURL=”https://SharePointOnlineSiteUrl”;
    ClientContext ctx = new ClientContext(siteURL);
    var securePassword = new SecureString();
    foreach (char c in password)
    securePassword.AppendChar(c);
    SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(login, securePassword);
    ctx.Credentials = credentials;
    Web wsite = ctx.Web;
    ctx.Load(wsite, w => w.HasUniqueRoleAssignments, w => w.RoleAssignments.Include(roleAssigned => roleAssigned.Member.Title,
    roleAssigned => roleAssigned.RoleDefinitionBindings.Include(roleDef => roleDef.Name)));
    ctx.ExecuteQuery();
    RoleAssignmentCollection rac = wsite.RoleAssignments;
    if (rac != null && rac.Count !=0)
    Console.WriteLine("Unique Permissions: " + wsite.HasUniqueRoleAssignments);
    foreach (RoleAssignment ra in rac)
    Console.WriteLine("Group Name: " + ra.Member.Title);
    foreach (RoleDefinition rd in ra.RoleDefinitionBindings)
    Console.WriteLine("Permission: " + rd.Name);
    Console.ReadKey();
    More information:
    http://social.technet.microsoft.com/wiki/contents/articles/24087.associate-permission-levels-with-sharepoint-user-groups-using-the-client-side-object-model-in-netc.aspx
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Can we query more than 5000 library items in Sharepoint online library using CSOM?

    I am writing a console application to fetch all documents from the SharePoint Online Site. I am worrying what happens if library items grow beyond 5000 items. In my earlier experience from SP2010, I will raise the threshold limit from Central Admin Site
    and then perform my CAML query operation. In SharePoint Online Site, is this possible ? If not, is there any alternative to get all the documents above 5000 limit ?

    At the moment I wouldn't advise it without using folders.
    You can, definitely, add more than 5k items in Office 365 lists. If you design them well and add indexes before you go over the threshold then it should be fine.
    HOWEVER, once you go over the 5k threshold you lose the ability to change all the items in the list at once. Which means you can't add indexes to columns, can't add new columns, can't remove columns or perform any large admin task.
    Incidentally CAML queries and upping the threshold are either/or options in on-premises installs. CAML is the way forward and can be used without increasing the threshold in the vast majority of cases.
    In terms of support the MS documentation is unhelpful:
    http://office.microsoft.com/en-gb/office365-sharepoint-online-enterprise-help/sharepoint-online-software-boundaries-and-limits-HA102694293.aspx
    There it states that MS only support 5k items in a site list/library.

  • Remove/hide "new item or edit this list" link of sharepoint online (office 365) with csom

    as title, I delevelop an app for sharepoint online, so I must use client api to operate sharepoint object. now, i need to remove/hide the link “new item or edit this list”, not use js do it, what can i do? help!!

    Hi,
    Per my understanding, you might want to remove the link “new item or edit this list” of a list view web part using Client Object Model.
    As there is no such property in
    WebPart object can be used to hide/remove the link, I suggest you apply custom CSS style to the page which contains the list view
    web part to hide it.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Creating a folder for a document library in SharePoint online

    Hello I am looking for a good place to get started on creating a folder for a document library using a powershell script. Thanks in advance for any help.

    Here is a guide to creating folders and items in a document library for SharePoint Server/Foundation: Creating SharePoint Folders
    and Items with PowerShell. You will need to tailor it to your needs as it's a demo for creating 50,000 items.
    That's step 1 and contains the bulk of what you would need to do. Here's an example of connecting to a library in SharePoint Online using CSOM: Office
    365 - PowerShell Script to Upload Files to a Document Library using CSOM. You won't be uploading files, but the parts where you connect and get a list are what you're interested in.
    Now you'll combine bits from both of these scripts:
    1. Connect to SPO
    2. Get your list (looks like you need to first get the site collection and then the site)
    3. Create a folder
    I figure it would look something like this (note I haven't tested this at all):
    #Specify tenant admin and site URL
    $User = "[email protected]"
    $SiteURL = "https://tenant.sharepoint.com/sites/site"
    $DocLibName = "DocLib"$FolderTitle = "Example Folder"
    #Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
    Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
    $Password = Read-Host -Prompt "Please enter your password" -AsSecureString
    #Bind to site collection
    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
    $Context.Credentials = $Creds
    #Retrieve list
    $List = $Context.Web.Lists.GetByTitle($DocLibName)
    $folder = $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder)
    $folder["Title"] = $FolderTitle
    $folder.Update();
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Powershell Error for SharePoint Online -"The remote server returned an error: (407) Proxy Authentication Required."

    I am trying to call sharepoint online from powershell. Below is the code. I get 
    Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
    $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    $webUrl = "ZZZZ"
    $username = "XXX"
    $password = "YYYY"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) 
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $web = $ctx.Web
    $lists = $web.Lists 
    $ctx.Load($lists)
    $ctx.ExecuteQuery()
    $lists| select -Property Title
    Raj-Shpt

    Hi,
    About how to access SharePoint online site using PowerShell, the blog below would be helpful:
    http://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx
    Another two demos for your reference:
    http://www.hartsteve.com/2013/06/sharepoint-online-powershell/
    http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in-PowerShell-scripts-with-Office365.html
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Issue in adding new items to a O365 SharePoint Online List having lookup columns (Client Object Model)

    I have two Lists i.e. Publisher and Products in my SharePoint Online site. They are having the following structures:
    1. Publisher:
    Publisher (Single line of txt)
         A1
         A2
         A3
         A4
         A5
         A6
    2. Products:
    Publisher (lookup to the above column)       
    ProductName (Single line of txt)
         A1                                                                   Apple
         A2                                                                   Samsung
         A3                                                                   Nokia
    And I have an excel file named Products.xlsx in my local machine which has the following data:
    Publisher        ProductName
         A1                   Apple
         A2                   Samsung
         A3                   Nokia
         A4                   Motorola
         A5                   LG
         A6                   HTC
    Now I have written the below client-side (CSOM) code to fetch the data from the Excel and update the corresponding fields in the Products table:
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Web;
    using System.IO;
    using System.Data;
    using System.Data.OleDb;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Client;
    using File =
    Microsoft.SharePoint.Client.File;
    using System.Security;
    namespace ExcelToSP
        public class
    ExcelToSP
            //Main function to get the command line values and invoke the getSPList function to pull SP List data
            public
    static void Main(string[] args)
                //Instantiate Class object
                ExcelToSP p
    = new ExcelToSP();
                try
                    p.LoadExcelData();
    //Exit with Sucess code
    Environment.Exit(0);
                catch
    (Exception ex)
    //Invoke writeErrorLog function to log the exception details
    //p.WriteErrorLog(ex);
            public
    void LoadExcelData()
                try
                string fileName
    = @"E:\Products.xlsx";
                string fileExtension
    = Path.GetExtension(fileName).ToUpper();
                string connectionString
    = "";
                 if
    (fileExtension == ".XLS")
                    connectionString
    = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='"
    + fileName + "'; Extended Properties='Excel 8.0;HDR=YES;'";
                else
    if (fileExtension ==
    ".XLSX")
                    connectionString
    = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='"
    + fileName + "';Extended Properties='Excel 12.0 Xml;HDR=YES;'";
                if
    (!(string.IsNullOrEmpty(connectionString)))
    string[] sheetNames =
    GetExcelSheetNames(connectionString);
    if ((sheetNames !=
    null) &&
    (sheetNames.Length
    > 0))
    DataTable dt = null;
    OleDbConnection con =
    new OleDbConnection(connectionString);
    OleDbDataAdapter da =
    new OleDbDataAdapter("SELECT * FROM ["
    + sheetNames[0]
    + "]", con);
                        dt
    = new DataTable();
                        da.Fill(dt);
    InsertIntoList(dt,"Products");
                catch
    (Exception ex)
    throw ex;
            private
    string[] GetExcelSheetNames(string strConnection)
                var connectionString
    = strConnection;
                String[] excelSheets;
                using
    (var connection =
    new OleDbConnection(connectionString))
                    connection.Open();
    var dt = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
    null);
    if (dt ==
    null)
    return null;
                    excelSheets
    = new String[dt.Rows.Count];
    int i = 0;
    // Add the sheet name to the string array.
    foreach (DataRow row
    in dt.Rows)
                        excelSheets[i]
    = row["TABLE_NAME"].ToString();
                        i++;
                return excelSheets;
            private
    void InsertIntoList(DataTable listTable,
    string ListName)
                try
    string username = "[email protected]";
    string pwd = "contoso@1234";//this.Dts.Variables["password"].Value.ToString();
    ClientContext clientContext =
    new ClientContext("https://contoso.sharepoint.com/teams/myPOC/");
    SecureString password =
    new SecureString();
    char[] decryptpwd = pwd.ToCharArray();
    foreach (char c
    in decryptpwd)
                        password.AppendChar(c);
                    clientContext.Credentials
    = new SharePointOnlineCredentials(username, password);
                    clientContext.ExecuteQuery();
    //Setting SiteURL Client context
    Web web = clientContext.Web;//
                    clientContext.Load(web);
                    clientContext.ExecuteQuery();
    List lstProductFamily = web.Lists.GetByTitle("Products");
    for (int iRow
    = 0; iRow < listTable.Rows.Count; iRow++)
    ListItemCreationInformation itemCreateInfo =
    new ListItemCreationInformation();
    ListItem newItem = lstProductFamily.AddItem(itemCreateInfo);
    //FieldLookupValue flv = newItem["Publisher"] as FieldLookupValue ;
    //string lkup = flv.LookupValue;
    //int valueid = 0;
    //valueid = flv.LookupId;
                        newItem["Publisher"]
    = Convert.ToString(listTable.Rows[iRow][0]);
                        newItem["ProductName"]
    = Convert.ToString(listTable.Rows[iRow][1]);
                        newItem.Update();
                        clientContext.ExecuteQuery();
                catch
    (Exception ex)
    throw ex;
    But I'm getting the following error on running the above code "Invalid data has been used to update the list item. The field you are trying to update may be read only." 
    Can anybody please help me out?

    Hi,
    According to your description, my understanding is that you want to update data to look up field.
    I have a test about updating look up field using Client Object Model in my environment. lookup field will accept an array to set the field value.
    Here is the code snippet:
    Microsoft.SharePoint.Client.ClientContext ctx = new ClientContext("http://sp2013sps/sites/test/");
    if (ctx != null)
    List list = ctx.Web.Lists.GetByTitle("List3");
    ListItem itemToUpdate = list.GetItemById(1);
    ctx.Load(itemToUpdate);
    ctx.ExecuteQuery();
    FieldLookupValue newLookUpField = new FieldLookupValue();
    newLookUpField.LookupId = 3;
    FieldLookupValue newLookUpField1 = new FieldLookupValue();
    newLookUpField1.LookupId = 4;
    FieldLookupValue[] newarr = { newLookUpField, newLookUpField1 };
    itemToUpdate["lookup"] = newarr;
    itemToUpdate.Update();
    ctx.Load(itemToUpdate);
    ctx.ExecuteQuery();
    Best regards
    Patrick Liang
    TechNet Community Support

Maybe you are looking for