Share Invitation via Client Object Model

On SharePoint Online Using the "Share" button in the upper right area of the page one can invite a person to join the site.  Then the person will get an email and provided the email address is linked to a Microsoft account that person may
join the site.  Here are two questions:
Is there a Client Object Model equivalent to the "Share" form, thus automating the process via an external web service?
What is the expected delay and in fact what is the reason for the delay between when the person gets the email and when they can accept the invitation without receiving an error stating "That didn't work... [email address] can't be found in the [site
url] directory. Please try  again later".  The user was able to log in after some time.
Thanks

You can use the Sharing.DocumentSharingManager class with the method UpdateDocumentSharingInfo method in CSOM. The delay maybe the fact that when you assign a group to share the document with, then a timer job is queued to generate an email for each user
in the group. These are then queued to send the email out via whatever smtp server you have set up for SharePoint. This can cause some delays.
CSOM Link:https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.sharing.documentsharingmanager.updatedocumentsharinginfo.aspx
REST Link:
http://sharepointfieldnotes.blogspot.com/2014/09/sharing-documents-with-sharepoint-rest.html
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer

Similar Messages

  • Usage Reporting via client object model

    Hi,
    Is there any way that I can get the site last modified date, unique visitors per month via client object model?
    Is it so that to get the site last modified date i have to loop into all lists/libraries and get the lastitemmodifieddate property?
    -Prashant

    Hi,
    I do not think CAML Query object creation is required here because we directly get the lastitemmodifieddate property for the list. For e.g. like this and then do some operation on the date to get the recent date.
    ClientContext context = new ClientContext("http://server1/sites/TeamSite");
    Web oWeb = context.Web;
    context.Load(oWeb.Lists, lists => lists.Include(list => list.LastItemModifiedDate));
    context.ExecuteQuery();
    foreach (List list in oWeb.Lists)
    //string oTitle = list.Title;
    DateTime _lastModifiedDate = list.LastItemModifiedDate;
    -Prashant

  • 403 Forbidden Error while trying to access External SharePoint site Via Client Object Model

    Hi,
    I am accessing the External SharePoint site from an intranet. When I try to access local sharepoint site in my intranet via Client object model to upload few documents into a library, it works perfectly fine without any issues.
    But when I try to do the same (upload few docs ) to an external SharePoint 2010 site out of my intranet from my intranet, I get 403, forbidden error. It looks like there is some issue with login credentials of this site. But when I try to navigate to the
    site URL in Visual studio  2010, it asks for credentials and takes me to home page.
    I supplied the credentials in different forms like
    ctx.Credentials = new NetworkCredential("username", "password", "domain");
    and
    clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
    and
    FormsAuthenticationLoginInfo formsAuthInfo = new FormsAuthenticationLoginInfo("MyUser", "MyPassword");
    clientContext.FormsAuthenticationLoginInfo = formsAuthInfo;
    but nothing seems working and I get the Same 403 error. What am I missing here?
    Thanks,
    K.V.N.PAVAN

    Hi Pal,
    Thanks for posting your query, Just try to add credentials to your clientContext object as mentioned below
    NetworkCredential credentials =
         new NetworkCredential("username", "pwd", "domain");
    clientContext .Credentials = credentials;
    or use
    clientContext.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
    I hope this will be helpful to you, If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog :http://sharepoint-community.net/profile/DharmendraSingh

  • Client Object Model in Visual Webpart

    Hi
    I am new to Client Object Model.I've to create a visual web part in SharePoint 2013 via Client Object Model using
    SandBoxed solution.
    i did following.
    1-Created empty sharepoint project
    2-added two dlls for Client Object Model in the project
    Microsoft.SharePoint.Client
    Microsoft.SharePoint.Client.Runtime
    3-in the visual webpart .ascx file i just created asp label as  below
    <asp:Label ID="label1" runat="server"></asp:Label>
    4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
    5-when i deploy the code it deploys successfully,but when i try to insert this web-part on to the page it shows errors
    as below.
    Please tell me what am i doing wrong.Urgent help required.

    Yes,deployed as sandbox solution.Actually i want to create a visual webpart in Sharepoint 2013 using Client Object Model. How can i do this,i followed below steps.
    1-Created empty sharepoint project
    2-added two dlls for Client Object Model in the project
    Microsoft.SharePoint.Client
    Microsoft.SharePoint.Client.Runtime
    3-in the visual webpart .ascx file i just created asp label as  below
    <asp:Label ID="label1" runat="server"></asp:Label>
    4- in the visual webpart .cs file i write a client object model code to show title items in the label from the "Test" list as below.
    using Microsoft.SharePoint.Client;
    using System;
    using System.ComponentModel;
    using System.Web.UI.WebControls.WebParts;
    namespace SharePointProject2.VisualWebPart1
        [ToolboxItemAttribute(false)]
        public partial class VisualWebPart1 : WebPart
            // Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
            // using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
            // for production. Because the SecurityPermission attribute bypasses the security check for callers of
            // your constructor, it's not recommended for production purposes.
            // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
            public VisualWebPart1()
            protected override void OnInit(EventArgs e)
                base.OnInit(e);
                InitializeControl();
            protected void Page_Load(object sender, EventArgs e)
                ClientContext context = new ClientContext("http://spsiteURL");
                List testList = context.Web.Lists.GetByTitle("Test");
                CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
                ListItemCollection items = testList.GetItems(query);
                context.Load(items);
                context.ExecuteQuery();
                foreach (ListItem listItem in items)
                    label1.Text = label1.Text + ", " + listItem["Title"];
    If this is not the correct way then how can i  use client object model to get sharepoint list items.Please mention.

  • Can we write client object model code with Server object model?

    Hi everyone,
    I have to create one timer job using client object model (C#) in Sharepoint 2010 template on feature activation. Is it possible to write the code of client object in sharepoint empty project to create timer job? If yes/no? then why?
    Thanks in advance!!!

    Hi ShindeK,
    Yes you can used CSOM in Sharepoint but Timer jobs run directly on the server. The Client Side Object Model is a wrapper that brokers its calls to the server via the built in web services that SharePoint provides.
    You will not get any performance gains in this scenario using CSOM. You should use the full server object model of SharePoint
    SharePoint 2010 also has three Client Object Models (Managed, Silverlight, JavaScript) which are meant to be used by code accessing SharePoint remotely.
    --You can also used powershell script in timer job
    Chekc the link which cann help you step by step CSOM in Sharepoint timer job
    http://www.youtube.com/watch?v=Z7wHj-bSk0g
    You can also try the below link....
    https://bramdejager.wordpress.com/2013/08/02/using-csom-and-powershell-to-query-sharepoint-online-or-on-premise/
    http://stackoverflow.com/questions/3656920/run-sharepoint-timer-jobs-from-powershell
    Please mark the Answer and Vote me if you think that it will help you to resolved your issue

  • SharePoint 2010 client object model read survey list

    Hello all,
    please suggest me how to read
    questions and answers in a survey list using
    client object model
    if possible some code is fine.
    Like Cricket

    Hi,
    below is the code for reading the items from survey list in .Net managed client object modal share point 2010
    using (ClientContext context = new ClientContext("siteUrl"))
                    context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                    Web web = context.Web;
                    context.Load(web);
                    List survey = web.Lists.GetByTitle("SurveyListName");
                    FieldCollection fldColl = survey.Fields;
                    context.Load(fldColl);
                    ListItemCollection coll = survey.GetItems(CamlQuery.CreateAllItemsQuery());
                    context.Load(survey);
                    context.Load(coll);
                    context.ExecuteQuery();
                    //Load the questions and answers in the dictionary object
                    Dictionary<string, List<string>> questionAnswers = new Dictionary<string, List<string>>();
                    foreach (Field fld in fldColl)
                        if (fld.FieldTypeKind == FieldType.Choice && !fld.FromBaseType)
                            foreach (ListItem item in coll)
                                if (item.FieldValues.ContainsKey(fld.InternalName))
                                    string value = item.FieldValues[fld.InternalName].ToString();
                                    if (!string.IsNullOrEmpty(value))
                                        if (!questionAnswers.ContainsKey(fld.Title))
                                            List<string> values = new List<string>();
                                            values.Add(value);
                                            questionAnswers.Add(fld.Title, values);
                                        else
                                            List<string> oldValues = questionAnswers[fld.Title];
                                            oldValues.Add(value);
                                            questionAnswers[fld.Title] = oldValues;
    Thanks,
    Anil
    Anil

  • Accessing active directory with javascript client object model

    Hello All,
    my requirement is to get user profile "picture" from
    active directory of my org. to my sharepoint 2013 intranet site via
    java script client object model programming.
    I am successful in retrieving user details (including pics) from user profile services using SP.UserProfile.js but it will show only user who are added in SharePoint groups. But, I need all company users (10,000+ user's) data like name, dept, photo etc.
    If the solution is not feasible with JSOM, please provide any alternative.
    Pls. assist.
    Thanks, Chintan

    You can import profile from AD directly to sharepoint and use it
    Check below:
    http://blogs.technet.com/b/harmeetw/archive/2011/09/10/importing-thumbnail-photos-from-ad-active-directory-into-sharepoint-2010.aspx
    Once imported you need to run below:
    Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation
    http://<YourServerName>/my
    The cmdlet was introduced in this fix:
    http://support.microsoft.com/kb/2394320  (14.0.5128.5000)
    http://blogs.technet.com/b/lukeb/archive/2013/01/04/sharepoint-import-a-picture-from-ad-for-the-user-profile.aspx

  • Through SharePoint Client Object model, how to make color coded events on Sharepoint Calendar

    Hi,
    Through SharePoint Client Object model, how to make color coded events on Sharepoint Calendar.
    Plese share your knowledge.
    Regards
    Tharak

    Hi,
    According to your post, my understanding is that you wanted to make a color events Calendar.
    We can achieve it using the OOB method by creating the Calendars Overlay.
    http://summit7systems.com/color-code-calendar-events-in-sharepoint/
    You can also use the JavaScript to achieve it.
    http://spsawyer.wordpress.com/2013/07/18/sharepoint-color-calendar/
    http://www.planetwilson.co.uk/sharepoint-2013-colour-calendar-v2/
    more reference:
    http://usermanagedsolutions.com/SharePoint-User-Toolkit/Pages/Color-Coding-Calendar-List.aspx
    http://blog.pathtosharepoint.com/2010/04/06/tutorial-add-color-coding-to-your-sharepoint-2007-calendar-in-15-minutes/#comment-7231
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to execute XML batch commands using SharePoint Web services or Client Object Model

    Hi,
    I have a requirement to execute some batch commands to update SharePoint View Style, how can i do it using SharePoint webservices or SharePoint Client Object model.
          I need to execute the following Batch command over a particular web.
    <Method ID="UpdateView">
      <SetVar Name="Cmd">UpdateView</SetVar>
      <SetList Scope="Request">{GUID of List}</SetList>
      <SetVar Name="View">{GUID of View}</SetVar>  
      <SetVar Name="ViewStyle">6</SetVar>
      <SetVar Name="RowLimit">100</SetVar>
      <SetVar Name="Paged">TRUE</SetVar>
    </Method>

    Hi
    I tried it already... But UpdateView Method in the Views.asmx and Lists.asmx, both are not supporting for updating the style of the view (like Boxed, Newsletter...).
    If you have any code sample which will do this job with any of the SharePoint web services, please share it..

  • 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 to get all previous versions page contents of a publishing page using SharePoint Client Object Model 2010

    How to get all previous versions page contents and other field values of a publishing page using SharePoint Client Object Model 2010?
    Thanks,
    Osmita

    Hi Osmita,
    Greetings.
    Here are the links that helps you. It has code attached to it.
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/a0d2ab40-99ba-4368-8505-1dc559ef6469/get-content-of-previous-version-of-page-sharepoint-2010?forum=sharepointgeneralprevious
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/faaf419f-997e-4150-9911-48cc375c3b46/how-to-get-previous-published-versions-of-publishing-pages-in-sharepoint-2010?forum=sharepointdevelopmentprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Trying to use Web LCID property to get the List name in client object Model

    Hi ,
    I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use  web.Lists.GetByTitle("Personal
    Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and
    have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.
    Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.
    Then,My Question is that
    "All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"
     

    Hi,
    According to your post, my understanding is that your requirement is getting list in different language.
    Here are two ways for your reference:
    1. We can use getById method instead, so that we can avoid the language issue.
    2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:
    var userLcid =_spPageContextInfo.currentLanguage;
    var localizedStrings = {
    ListName: {
    _1033: "EnglishName",
    _3082: "SpanishName"
    var listName=localizedStrings.ListName["_" + userLcid];
    var list=web.Lists.getByTitle(listName);
    More information:
    http://msdn.microsoft.com/en-us/library/hh670609.aspx
    http://wellytonian.com/2012/11/language-packs-sharepoint-2010/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • 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

  • Unable to get the SharePoint 2013 List names using Client object model for the input URL

    Please can you help with this issue.
    We are not able to get the SharePoint 2013 List names using Client object model for the input URL.
    What we need is to use default credentials to authenticate user to get only those list which he has access to.
    clientContext.Credentials = Net.CredentialCache.DefaultCredentials
    But in this case we are getting error saying ‘The remote server returned an error: (401) Unauthorized.’
    Instead of passing Default Credentials, if we pass the User credentials using:
    clientContext.Credentials = New Net.NetworkCredential("Administrator", "password", "contoso")
    It authenticates the user and works fine. Since we are developing a web part, it would not be possible to pass the user credentials. Also, the sample source code works perfectly fine on the SharePoint 2010 environment. We need to get the same functionality
    working for SharePoint 2013.
    We are also facing the same issue while authenticating PSI(Project Server Interface) Web services for Project Server 2013.
    Can you please let us know how we can overcome the above issue? Please let us know if you need any further information from our end on the same.
    Sample code is here: http://www.projectsolution.com/Data/Support/MS/SharePointTestApplication.zip
    Regards, PJ Mistry (Email: [email protected] | Web: http://www.projectsolution.co.uk | Blog: EPMGuy.com)

    Hi Mistry,
    I sure that CSOM will authenticate without passing the
    "clientContext.Credentials = Net.CredentialCache.DefaultCredentials" by default. It will take the current login user credentials by default. For more details about the CSOM operations refer the below link.
    http://msdn.microsoft.com/en-us/library/office/fp179912.aspx
    -- Vadivelu B Life with SharePoint

  • How to get list of users who all are having full access in sharepoint site using client object model c#

    Hi,
    I want to fetch the list of users who all are having full access to the sharepoint list using client object model with .Net
    Please let me know if any property for the user object or any other way to get it.
    Thanks in advance.

    Here you are complete code i created from some years it lists all groups and users, you can just add a check in the permissions loop to see if it is equal to Full Control.
    Private void GetData(object obj)
    MyArgs args = obj as MyArgs;
    try
    if (args == null)
    return; // called without parameters or invalid type
    using (ClientContext clientContext = new ClientContext(args.URL))
    // clientContext.AuthenticationMode = ClientAuthenticationMode.;
    NetworkCredential credentials = new NetworkCredential(args.UserName, args.Password, args.Domain);
    clientContext.Credentials = credentials;
    RoleAssignmentCollection roles = clientContext.Web.RoleAssignments;
    ListViewItem lvi;
    ListViewItem.ListViewSubItem lvsi;
    ListViewItem lvigroup;
    ListViewItem.ListViewSubItem lvsigroup;
    clientContext.Load(roles);
    clientContext.ExecuteQuery();
    foreach (RoleAssignment orole in roles)
    clientContext.Load(orole.Member);
    clientContext.ExecuteQuery();
    //name
    //MessageBox.Show(orole.Member.LoginName);
    lvi = new ListViewItem();
    lvi.Text = orole.Member.LoginName;
    lvsi = new ListViewItem.ListViewSubItem();
    lvsi.Text = orole.Member.PrincipalType.ToString();
    lvi.SubItems.Add(lvsi);
    //get the type group or user
    // MessageBox.Show(orole.Member.PrincipalType.ToString());
    if (orole.Member.PrincipalType.ToString() == "SharePointGroup")
    lvigroup = new ListViewItem();
    lvigroup.Text = orole.Member.LoginName;
    // args.GroupsList.Items.Add(lvigroup);
    DoUpdate1(lvigroup);
    Group group = clientContext.Web.SiteGroups.GetById(orole.Member.Id);
    UserCollection collUser = group.Users;
    clientContext.Load(collUser);
    clientContext.ExecuteQuery();
    foreach (User oUser in collUser)
    lvigroup = new ListViewItem();
    lvigroup.Text = "";
    lvsigroup = new ListViewItem.ListViewSubItem();
    lvsigroup.Text = oUser.LoginName;
    lvigroup.SubItems.Add(lvsigroup);
    //args.GroupsList.Items.Add(lvigroup);
    DoUpdate1(lvigroup);
    // MessageBox.Show(oUser.LoginName);
    RoleDefinitionBindingCollection roleDefsbindings = null;
    roleDefsbindings = orole.RoleDefinitionBindings;
    clientContext.Load(roleDefsbindings);
    clientContext.ExecuteQuery();
    //permission level
    lvsi = new ListViewItem.ListViewSubItem();
    string permissionsstr = string.Empty;
    for (int i = 0; i < roleDefsbindings.Count; i++)
    if (i == roleDefsbindings.Count - 1)
    permissionsstr = permissionsstr += roleDefsbindings[i].Name;
    else
    permissionsstr = permissionsstr += roleDefsbindings[i].Name + ", ";
    lvsi.Text = permissionsstr;
    lvi.SubItems.Add(lvsi);
    // args.PermissionsList.Items.Add(lvi);
    DoUpdate2(lvi);
    catch (Exception ex)
    MessageBox.Show(ex.Message);
    finally
    DoUpdate3();
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation

Maybe you are looking for

  • Language in scheduling agreement

    Is it possible to change the language in scheduling agreement?

  • Migration from Oracle 8.1.5 to 8.1.7

    I have server 8.1.5 and have to install 8.1.7 in this PC. I have installed 8.1.7 in separate ordner. I have copied initORCL.ora in 8.1.7. Now both server work with same data. I have started script u0801050.sql. After that I have probleme: package sys

  • Default settings for items is not getting copied to items in Shopping Cart

    Hi SRM GURU's, I am facing a problme while creating shopping cart. I maintained default settings for items like Product catagory,Internal Notes etc. While adding items in shopping cart these default settings are not getting copied to any items. If an

  • "Select Same..." jusst as in Illustrator in InDesign?

    Hello All- Just wondering if anyone knows if there are any Indesign plug ins or scripts that work similar to Illustrators "Select Same..." feature of finding objects, type & strokes of the same color, value as what youhave already selected. I work in

  • How to write data in differt line in .txt file

    Hi all, I am tring to write data on one file using utl_file, the first cursor loop write data on first line of the file using utl_file.put_line(..........................); end the second cusor loop write the data on secion line of the same file usin