Advantages and Disadvantages of Client Object Model in sharepoint 2013

I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
like below in javascript. Users will have read/edit and approve access to the list.
  var clientContext = new SP.ClientContext.get_current();
       var oList = clientContext.get_web().get_lists().getByTitle('Workflow Tasks');
MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

Thanks 
AlexanderShelopukho for
right answer!
Alex-
I do not need comparison- 
I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

Similar Messages

  • Client object model in SharePoint 2013

    Hi,
    I have installed .Net 2012 and want to create one client object model .But SharePoint is not installed in my system.So how i will get the SharePoint templates in the .net and how i  am able to do this.
    Please help
    Thank you

    Hi,
    Thanks for reply.
    But i am working in client machine and i have to create app using client object model and i have no access to the server.
    As per your answer, you want say i have to install SharePoint in my client system ?
    Then only i get the sharepoint templates in the .Net ?

  • Item.SystemUpdate for Client Object Model in sharepoint 2010

    I have a javascript that modifies a column/field in the list item when opened. However, this changes the Last Modified By field of the item.
    is there a SystemUpdate method for Client Object Model?
    ----------------------- Sharepoint Newbie

    I got a work around for this problem..
    Before updating the Modified, Modified By values, First we need to Disable the version settings for document library. Once the fields updated then again we need to enable the version settings. 
    find the updated code below..
                                          //Disable Version settings for DOC LIB
    before update Metadata
                                            _List.EnableVersioning
    = false;
                                            _List.Update();
                                            _cContext.ExecuteQuery();
                                           ListItem item = newFile.ListItemAllFields;
                                           _cContext.Load(item);
                                            //Updating Metadata Created,
    CreatedBy, Modified, Modified By
                                             item["Created"]
    = "8/10/2013 7:04 PM";
                                             item["Author"] = CreatedUserValue;
                                             item["Modified"] = "8/10/2013 7:04 PM";
                                             item["Editor"] = ModifiedUserValue;
                                             item.Update();
                                            _cContext.ExecuteQuery();
                                            //Enable Version settings
    for DOC LIB after update Metadata
                                               _List.EnableVersioning
    = true;
                                              _List.Update();
                                            _cContext.ExecuteQuery();
    Rajendra

  • Is it possible to change the title of a webpart using client object model/c#/sharepoint online

    Hi folks!
    I have been busted my butt trying to Write a program changing the title of an existing webpart on on of our subsites on SharePoint online. But I keep getting an error in the very last context.executequery. Tried a bunch of different approaches, but I can't
    make it work. Before I start posting code; I Wonder if anyone have ever done this?
    Its a plain Windows form application, using Visual studio Express and the Client Object model. (Listsing the titles of the webparts Works but changing titles seem impossible. Thought it might be a checkin/out problem but it doesn't make a difference).
    Any help would be highle appreciated.
    Lars

    It depends: are you using the default style for Text Captions? In that case you can change the default style in the Object Style Manager and have it applied to all Captions.
    Or you can change one text caption, and in its Properties panel choose the option 'Save Changes to existing style' from the menu top right (see screenshot). Both methods will work if you didn't override the default Caption Style for those captions. Beware: Quizzing objects can use another style.

  • How to change 'Modified By' column value when a new file is uploaded in SharePoint 2013 using Client Object Model?

    I want to change 'Modified By' column value of a file that is being uploaded using Client Object Model in SharePoint 2013. The problem is that the version of the file is changing. Kindly help me. The code that I am using is:
    using (System.IO.Stream fileStream = System.IO.File.OpenRead(m_strFilePath))
        Microsoft.SharePoint.Client.File.SaveBinaryDirect(m_clientContext, str_URLOfFile, fileStream, true);
        Microsoft.SharePoint.Client.File fileUploaded = m_List.RootFolder.Files.GetByUrl(str_URLOfFile);
        m_clientContext.Load(fileUploaded);
        m_clientContext.ExecuteQuery();
        User user1 = m_Web.EnsureUser("User1");
        User user2 = m_Web.EnsureUser("User2");
        ListItem item = fileUploaded.ListItemAllFields;
        fileUploaded.CheckOut();
        item["UserDefinedColumn"] = "UserDefinedValue1";
        item["Title"] = "UserDefinedValue2";
        item["Editor"] = user1;
        item["Author"] = user2;
        item.Update();
        fileUploaded.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);
        m_clientContext.ExecuteQuery();

    Hi talib2608,
    Chris is correct for this issue, when calling update using ListItem.update method, it will increase item versions, using SystemUpdate and UpdateOverwriteVersion will update the list item overwrite version.
    these two methods are not available in CSOM/REST, only server object model is available for this.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • How to activate Custom Feature in SharePoint 2010 using Client Object model

    I am trying to Activate a custom feature using Client Object Model in SharePoint 2010. Here is the code I used. When I execute the code, I got the error "Feature with Id 'xx' is not installed in this farm, and cannot be added to this scope while
    creating site collection". Can anyone help?
    ClientContext clientContext = new ClientContext(spURL);
    //GUID of the custom feature                    
    Guid districtFeatureId = new Guid("5b3529de-5045-46da-af87-8d2e32c121a7");
    Site clientSite = clientContext.Site;
    FeatureCollection clientSiteFeatures = clientSite.Features;
    clientContext.Load(clientSiteFeatures);
    clientContext.ExecuteQuery();
    //Activate the feature
    clientSiteFeatures.Add(districtFeatureId, false, FeatureDefinitionScope.Site);
    clientContext.ExecuteQuery();

    Hi shil chan,
    When you activate a feature on the site collection, the feature should be scoped to site or farm, the error message shows it cannot find the specific feature, this will happen when you have a feature in web
    scope or the feature isn’t installed.  
    So, to troubleshooting this issue:
    Verify whether the feature is scoped to web. Please go to
    Site Setting->Site Features . If the feature is a web scope feature, then add the feature to webfeatures.
    Make sure the feature is installed correctly.
    Please inform me freely if you have any questions.
    Thanks

  • Client Object Model Sharepoint 2010

    We are using client object model in sharepoint 2010
    When we excute the ExcuteQuery method of clinet obejct model we are getting following error
    The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again
    Girish

    Hi ,
    A FormDigest control has to be included to create a digest for security validations when performing some modifications to SharePoint data. It adds a security token inside your page based on user, site and time. Once the page is posted back the security token
    is validated. Once the security token is generated it’s valid for a configurable amount of time. 
    for more info check the below links
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formdigest.aspx
    http://ranaictiu-technicalblog.blogspot.com.au/2010/02/sharepoint-2010-client-object-model-for.html
    if above link is not working, use below function before execute the query.
    function CustomUpdateFormDigest()
    if(window._spPageContextInfo != null)
    var $v_2 = window._spPageContextInfo;
    var $v_3 = $v_2.webServerRelativeUrl;
    var $v_4 = window._spFormDigestRefreshInterval;
    UpdateFormDigest($v_3, $v_4);
    CustomUpdateFormDigest();
    Please mark it as an answer/helpful if it is useful.
    Thanks
    Mahesh

  • SharePoint 2013 implement simple logout button which do not redirect to default sign out page using JavaScript client object model

    I am using windows authentication in my web application.
    My requirement is to implement a sign out button which will sign out the user without having him to close the browser and application should not ask him to login again.
    I tried following two options:
     1. Redirecting the user to default signout.aspx page " /_layouts/15/SignOut.aspx "
     2. Using "Sign In as a different user" URL " /_layouts/15/closeConnection.aspx?loginasanotheruser=true "
    In first case, user is redirected to default sign out page but he can press "Go Back to Site" link to revisit the site. Another major issue is that the user has to close the browser to sign out from the application completely, which is not desirable
    in my project requirement.
    In second case, the the current user is signed out of the application but if the user has saved the password in browser, he gets signed in automatically to the application.
    I also came across the solution where we replace the default sign out page with a custom sign out page, but I am not sure whether it can be implemented using JavaScript Client Object Model of SharePoint.

    Hi 
    I'm basically looking for the exact answer for the query.
    Meanwhile you need to go through the link mentioned below in order to understand how to do it.
    Debugging and Logging Capabilities in SharePoint 2010
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • CAML Query to get specific item in folder based on dropdown value using Javascript client object model

    Hi,
    I am using the Javascript Client object model.
    I have a custom list and a custom document library.
    Custom list contains 2 columns - dlName , dlValue
    The document library contains 2 folders - "folder1" ,  "folder2" and contains some images.
    The image name starts with the "dlValue" available in the custom list
    I am using a visual webpart and using javascript client object model.
    I am trying to achieve the below functionality:
    1) Load a dropdown with the custom list.
    2) set the image based on the value in dropdown.
    I have achieved the first option, I have set the dropdown, but not sure how to query the folder and set the image.
    Below is the code i have used so far:
    //In Visual webpart
    <select id="ddlTest" >
    </select>
    <br/>
    <div id="PreviewLayer">
    <img id="imgPlaceHolder" runat="server" alt="Image" title="imgPlaceHolder" src=" " />
    </div>
    // In Javascript file
    function RenderHtmlOnSuccess() {
    var ddlTest = this.document.getElementById("ddlTest");
    ddlTest.options.length = 0;
    var enumerator = this.customListItems.getEnumerator();
    while (enumerator.moveNext()) {
    var currentItem = enumerator.get_current();
    var dropdownValue = currentItem.get_item("dlValue");
    ddlTest.options[ddlTest.options.length] = new Option(currentItem.get_item("dlName"), dropdownValue);
    setImage(dropdownValue); // Not sure how to query the folder and set the image based on value.
    // Also if dropdown value is changed, corresponding image should be shown
    How to query the folder and based on dropdown value, show the image? Also, how to handle the dropdown value change?
    Thanks

    Hi,
    Here are two links for your reference:
    Example of how to Get Files from a Folder using Ecmascript \ Javascript client object model in SharePoint 2010
    http://sharepointmantra.wordpress.com/2013/10/19/example-of-how-to-get-files-from-a-folder-using-ecmascript-javascript-client-object-model-in-sharepoint-2010/
    SP2010 JSOM Client Object Model: How to get all documents in libraries including all folders recursively
    http://sharepoint.stackexchange.com/questions/70185/sp2010-jsom-client-object-model-how-to-get-all-documents-in-libraries-including
    In SharePoint 2013, we can also use REST API to achieve it.
    http://msdn.microsoft.com/en-us/magazine/dn198245.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

  • Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010

    Hello All,
    As per my requirement I have a two custom list.
    Agent Details
    Port Name
    Agent Details contains Agent code, Port Name,  email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
    Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
    Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
    when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list. 
    After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
    name list) to Agent Details custom list.
    Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
    Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
    Is anything am doing wrong then please guide me.

    Hi,
    As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
    The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
    You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
    When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
    having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
    The articles below are about how to debug in the event receiver in SharePoint 2010.
    http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
    http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
    http://sharesaint.com/?p=77
    Best regards,
    Sara Fan
    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]

  • How can I get an item and it's attachments from the current list using SP's JavaScript Client Object Model on newform.aspx?

    I only recently learned/read about SharePoint's JavaScript Client Object Model. I'm reading online trying to figure this out but not having much luck.
    On newform.aspx (and dispform.aspx) I want to get the
    current list,
    the last item created, and it's attachments. I now the CAML query I need to get the last item created, but first I have to get the current list and I am not sure how to do that.
    I tried this but it returns null:
    SP.ListOperation.Selection.getSelectedList()

    Hi,
    For your issue, you can get the list name from the new form url and retrieve the list last created item :
    https://social.msdn.microsoft.com/Forums/office/en-US/b90a64f8-2255-41b0-9d91-78335dd4a4cf/get-list-name-from-list-url-through-javascript?forum=sharepointdevelopmentprevious
    http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Powershell and Client Object Model - no error thrown if user is added more than once to same site or group

    Hello All -
    I am trying to add a user to a SharePoint site using PowerShell like below:-
    New-SPUser -UserAlias MyDomain\jan20a -Web http://SPServer/sites/MySite
    If I execute the above more than once, SharePoint does not throw that user already exists or something. This is not the same behavior in AD/Exchange PowerShell cmdlets.
    Also, even the client object model behaves the same way.
    Another interesting thing I noticed, I tried to remove a user from group in which the user was not part of it at all and still no error..!!
    Looks like SharePoint does not care of invalid input and just ignores it.
    Can anyone please confirm this and also the reason behind it ?

    It's not really invalid input, since the user exists and that is how SharePoint behaves (will behave same way in browser).  Try to input a user that and misspell the name, e.g. say you didn't have a MyDomain\Jan21a, then try to use same script above,
    only with invalid data.  It will bark at you.  Or try using a web that it cannot find, one that does not exist.  You'll get what I like to call, the red badge of courage if you enter invalid data.
    you can test that sharepoint will let you enter a user twice in the browser, and nothing bad comes from it.  Powershell is just unable to tell that the user was not in the site, when you removed it the second time. 
    Hope that confirms it, if it does please mark this reply accordingly.  thanks
    Stacy Simpkins | MCSE SharePoint | www.sharepointpapa.com

  • Sharepoint client object model - Pull files from one site and move to another

    Dear All,
    I am using client object model to retrieve files of certain criteria using caml query and copy them to some other site using 
    client object model. There is no exception being thrown, but the application is not performing either. No files are being copied to destination. Here is the code. Please advise.
    The message box that I have kept at the end is being displayed, but no files are being copied.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Net;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Microsoft.SharePoint;
    using SP = Microsoft.SharePoint.Client;
    namespace WindowsFormsApplication2
        public partial class Form1 : Form
            public Form1()
                InitializeComponent();
            private void Form1_Load(object sender, EventArgs e)
            private void button1_Click(object sender, EventArgs e)
                SP.ClientContext srcContext = new SP.ClientContext(textBox1.Text);
                srcContext.Credentials = new NetworkCredential(textBox3.Text, textBox4.Text, textBox5.Text);
                SP.ClientContext destContext = new SP.ClientContext(textBox2.Text);
                destContext.Credentials = new NetworkCredential(textBox3.Text, textBox4.Text, textBox5.Text);
                SP.CamlQuery camlQuery = new SP.CamlQuery();
                camlQuery.ViewXml = "<View Scope='RecursiveAll'><Query><Where><And><Geq><FieldRef Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2013-01-01T04:16:20Z</Value></Geq><And><Lt><FieldRef
    Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2013-12-31T04:16:43Z</Value></Lt><Or><Eq><FieldRef Name='Document_x0020_Classification' /><Value Type='Choice'></Value></Eq><Eq><FieldRef
    Name='Document_x0020_Classification' /><Value Type='Choice'>Case Studies</Value></Eq></Or></And></And></Where></Query></View>";
                SP.Web oWebsite = srcContext.Web;
                srcContext.Load(oWebsite, website => website.Webs);
                srcContext.ExecuteQuery();
                SP.Web dWebsite = destContext.Web;
                destContext.Load(dWebsite);
                destContext.ExecuteQuery();
                foreach (SP.Web web in oWebsite.Webs)
                    MessageBox.Show(web.Title);
                    foreach (SP.List list in web.Lists)
                        if (list.BaseType.ToString() == "DocumentLibrary")
                            MessageBox.Show(list.Title);
                            SP.ListItemCollection collListItem = list.GetItems(camlQuery);
                            srcContext.Load(collListItem);
                            srcContext.ExecuteQuery();
                            foreach (var doc in collListItem)
                                        SP.File f = doc.File;
                                        srcContext.Load(f);
                                        srcContext.ExecuteQuery();
                                        string destLibrary = "shared Documents";
                                        string nLocation = dWebsite.ServerRelativeUrl.TrimEnd('/') + "/" + destLibrary.Replace(" ", "")
    + "/" + f.Name;
                                        SP.FileInformation fileInfo = SP.File.OpenBinaryDirect(srcContext, f.ServerRelativeUrl);
                                        SP.File.SaveBinaryDirect(destContext, nLocation, fileInfo.Stream, true);
                MessageBox.Show("Completed");
    sk.Rakhishma

    Hi,
    To copy files from one site collection to another site collection, the simplest way is to open document library in windows explorer view.
    Go to document library, click library tab, click open with explorer.
    You can open the document library1 in explorer then copy the files which you want to paste to another site collection
    document library2, then open the document library2 in explorer to paste the documents.
    Besides, there are other method:
    https://social.msdn.microsoft.com/Forums/office/en-US/67282348-25c7-4bd0-9d95-61024c6892f9/how-we-move-a-document-library-from-one-site-collection-to-another-sitecollection?forum=sharepointgeneralprevious
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/8c112d85-1ab8-426b-be37-d010cf8647fe/copy-a-list-from-one-site-collection-to-another-using-web-service
    Best Regards,
    Lisa Chen
    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]

  • Error in Application.Run(DisplayLoginForm) and Remote Authentication in SharePoint Online Using the Client Object Model

    Hi guys
    I Think that is a simple error, but I don’t have enough knowledge in .NET apps.
    I make an console app that use Remote Authentication in SharePoint Online Using the Client Object Model, that a I downloaded from MSDN.
    This App run ok.
    But when I like to make a Windows From App. This component send me an error in Application.Run(DisplayLoginForm)
    This err msg :
     An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
    Additional information: Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead.
    Is there any way to use a form inside a windows form?
    Thank in advance
    Ramiro
    Ramiro B

    Hi,
    Based on the error message, please do as following:
    1. Check your code logic below:
    void btn_Click(object sender, System.EventArgs e)
    Thread t = new Thread(StartMyForm);
    t.TrySetApartmentState(ApartmentState.STA);
    t.Start();
    public static void StartMyForm()
    Application.Run(new MyForm(..));
    2.Try to add the following code line in your code.
    Application.Restart();
    If the issue still exists, please provide your requirement and code for a further research.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Attach a custom content type and set as default for picture library using client object model

    Hi,
    How to associate custom content type to a picture libraray and set it as default using the client object model?
    Thanks

    Hello,
    Here you go:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/b1de0697-0006-4f89-8909-1b94aa18ad89/how-to-reorder-content-types-in-list-with-client-context
    http://www.niteenbadgujar.com/2013/05/change-default-content-type.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for