Open Edit form directly when list item is clicked in Sharepoint 2013 list

Hi,
I have a list web part, wherein the user clicks the item it should open in the Edit form directly. various forum i checked was for SharePoint 2010, as we do not have design mode in SharePoint designer 2013, I am unable to do.. I know
if I the change the form type from default page to edit page, it will work, but not sure about how to go ahead. Could anyone help me to achieve this please....

Sunitha,
You can do this with some jQuery and JavaScript.  Look at this post:
http://brandonatkinson.blogspot.com/2013/11/open-sharepoint-2013-list-items.html
Basically, add a Script Editor Web Part to the page and include this snippet:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(function() {
// Change all display form links to edit form links
$('.ms-vb a[href*="listform.aspx"]').each(function(){
var link = $(this).attr('href');
link = link.replace("PageType=4", "PageType=6");
$(this).attr('href', link);
</script>
Brandon Atkinson
Blog: http://brandonatkinson.blogspot.com

Similar Messages

  • Workflow not triggering when changing Item-level Permissions in Sharepoint 2013 list

    Scenario:
    We have a custom list in Sharepoint 2013 that we use for Case Management. We have a workflow that triggers on a created item generated from an email. The user then gets a reply with a link to his own case.
    I want the users only to be able to see their own cases and no one elses.  When I change this under
    Advanced Settings under List Settings and
    Item-level Permissions and set them to Read items that were created by the user
    and Create items and edit items that were created by the user
    the workflow doesn´t trigger.
    How can I resolve this? I've tried every possible out-of-the-box permissions but with no result. Help!
    Thanks in advance!
    // Browncreek

    When you're testing , remember you cant trigger declarative workflow from the System Account - you need a general user account for auto-trigger workflows.  Good luck!
    Chris McNulty MCSE/MCTS/MSA/MVTSP | blog http://www.chrismcnulty.net/blog | twitter @cmcnulty2000 Microsoft Community Contributor Award 2011
    Hi, I have the same problem. Except that I am not using an email to create a new item. The item is created by members of a SharePoint group that have Contribute access to the list. When use the same settings i.e.
    Read items that were created by the user and Create items and edit items that were created by the user,
    the workflow does not trigger. If I set it back to Real all items and Create
    and Edit all items, it triggers the workflow.
    Please help me resolve as I have rolled this out to pilot users and am having this trouble.
    Thanks,
    Vishal

  • Get list items using spservices for sharepoint 2013

    Hi,
    I have a requirement like below.
    I have 2 sharepoint custom list with some columns.
    List1:listA
    List2:listB
    Now when i open the listB new item form i want some of the field values from listA should auto populate in Textboxes of listB new form.
    Is there any ways to implement this?
    Regards,
    Poovi

    Hi Poovi,
    You can achieve this using jQuery to get the SharePoint list items. Refer the below articles. It has explained how to get list items using jQuery and auto populate a text-box from a list item as a source.
    You can put this code in list forms through SharePoint Designer. The articles explain about auto populating text box of web part but similarly you can implement it for list form, because nevertheless the text boxes are same.
    http://www.c-sharpcorner.com/UploadFile/sagarp/sharepoint-2010-jquery-autocomplete-textbox-containing-list/
    http://tomvangaever.be/blogv2/2011/07/sharepoint-2010-autocomplete-with-list-items/
    Please remember to click 'Mark as Answer' if the reply answers your query or 'Upvote' if it helps you.

  • Uploading multiple documents into sharepoint list item with REST in sharepoint 2013 using content editor web part :

    hi ,
    i am trying to upload multiple document files into sharepoint list item. I followed below link for implementaion.
    http://techfindings-prem.blogspot.in/search/label/jquery.multifilejs
    It was working for sharepoint hosted app.
     This complete code is written within content edito web part.
    It was working when i was in root site collection with below change (hard coded the root level url) in code in "UploadFile" function.
    var scriptbase = "http://servername" + "/_layouts/15/";
                console.log(' File size:' + bytes.length);
                $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    But the issue came in picture when i was working with the other site collection instead of root one. The url was like below.
    "http://servername/sites/cpg/". This time i need to be there within "cpg" site collection. 
    Now if i hard code the url as i did above my code gets break here while come to below line
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
    I am getting error when i used below code:
    var scriptbase = "http://servername" + "/_layouts/15/";
     $.getScript(scriptbase + "SP.RequestExecutor.js", function () {
                    var createitem = new SP.RequestExecutor("http://servername");
                    createitem.executeAsync({
                        url: "http://servername/sites/cpg/" + "/_api/web/lists/GetByTitle('SalesRecord')/items(" + attachmentitemid + ")/AttachmentFiles/add(FileName='"
    + fileName + "')",
                        method: "POST",
                        binaryStringRequestBody: true,
                        body: binary,
                        success: fsucc,
                        error: ferr,
                        state: "Update"
                    function fsucc(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(data + ' uploaded successfully');
                        deferred.resolve(data);
                    function ferr(data) {
                        //alert( data.statusText + "\n\n" + data.responseText);
                        console.log(fileName + "not uploaded error");
                        deferred.reject(data);
    Please hekp in this case. This complete code is written within content edito web part. 
    Regards:
    Sanjay Joshi

    Hi,
    According to your post, my understanding is that you have an issue about upload multiple documents files into library vai REST API.
    As you have said, you have used the hard code url in your code.
    How about use the _spPageContextInfo.webAbsoluteUrl method to get the url?
    I have used this method to get the url, then use the code in the article you have pasted within a content editor web part to upload the files.
    You can replace the hard code url with the _spPageContextInfo.webAbsoluteUrl method, then check whether it works.
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

  • Need to update the list item in the same sharepoint list with particular condition with Sharepoint Designer 2013.

    Hi All
    I have one sharepoint list with huge data i.e with 20columns and more than 200 records with the fields .
    Suppose lets consider there are A,B,C,D,E,F,G,H columns.
    Now i want to create one form with the fields A,C,E.
    When the user enter the existing data of list for columns A,C..based on C value the E column value should change and update that particular item in the list.
    Please guide me without visual web part can we acheive this by Sharepoint designer 2013 or what would be the preferable solution.
    Please help me on this as it is very urgent from me..
    Thanks in Advance
    Sowjanya G

    Hi,
    According to your post, my understanding is that you wanted to update the list item in the same sharepoint list with particular condition with Sharepoint Designer 2013.
    I recommend to create workflow associated to the list and then start the workflow automatically when an item is changed.
    In the workflow, you can add condition and actions as below:
    If current item: C equal to Test1
         Set E to Test2
    Then the value of the filed E will be changed based on the value of the filed C.
    In addition, if you create the form using InfoPath, you can add rule to the filed C as below:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Sharepoint 2013 list view quick edit does not work with out remote API permissions

    sharepoint 2013 list view quick edit does not work with out remote API permissions.
    When I give Use Remote Interfaces  -  Use SOAP, Web DAV, the Client Object Model or SharePoint Designer interfaces to access the Web site it works which is not an ideal situation..
    MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead

    This is true. If you use Fiddler to watch the requests from the list view quick edit you can see CSOM calls. For example when changing a value in a cell, when you tab out you will see the SetFieldValue and Update method calls on the list item.
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • SharePoint 2013 List - Multiple Data Types in the Same List

    In the same SharePoint 2013 list in Data Sheet View, I want to have one column where my end users enter inputs for KPIs. There are 3 groups of KPIs (A, B and C) and they each have different data types (A-string, B-decimal, C-percentage) and I want to be
    able to base their input options off of the KPI type
    Does anyone have any suggestions on how I can leverage my parent-child relationships so when an end user...
    1. Picks KPI type A, they can select from a choice filed (Green, Yellow, Red)
    2. Picks KPI Type B, they can enter a decimal (-1.000 to 2.000)
    3. Picks KPI Type C, they can enter a percentage (-100.00% to 100.00%
    I'm using if I want to keep this in one list, one column and in data sheet view that the out of the box solutions won't meet my requirements. I was looking at some solutions from Bamboo (Lookup Selector Column) but don't think that applies here.
    Thanks!
    Johnny

    Hi Johnny, you can accomplish this using cascading lookups in InfoPath if that program is available to you. Otherwise, if you want a 3rd party product, we use the Kwiz cascading lookup and it's worked wonders for us:
    http://www.kwizcom.com/sharepoint-add-ons/sharepoint-cascading-lookup-plus/overview/
    Note: I have no relationship with Kwiz, just vouching for the product.
    cameron rautmann

  • 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 do I pull SharePoint 2013 list data using a SQL Query

    I have been asked to write a sql query to pull data from a SharePoint 2013  List.it needs to return all the columns
    Basically a Select all from the specific SharePoint list Database
    I do have the  list GUID ID. But not sure  which  SQL Table or Database to look in for list data.. the site and the list is in our main SharePoint site collection.
    the query only needs to be saved in SQL server

    I know it isn't support but sometimes you have to share data with other programs....
     I'm stuck.. I was able to get this far...
    SELECT * FROM dbo.Lists
    where tp_Title ='List Name'
     how do I pull the columns of the list?
    I think I still need the specific list not just the master list dbo....
    those two links do not work for SQL server  and SharePoint 2013

  • How to have profile thumbnails image appear in a SharePoint 2013 list?

    Hello,
    I am not using MySites, but have a SharePoint 2013 list with profiles in them.  They were imported from Active Directory, where I do have thumbnail images for each profile.  I am using SharePoint 2013.  How would I get these images from AD
    into the SharePoint list?  I have the attribute setup in User Profiles Synchronization, but the images did not show up.  I followed these steps in this posting, but I did not do the PowerShell step, since I am not using MySites. 
    http://richardstk.com/2013/04/12/import-user-photos-from-active-directory-into-sharepoint-2013/
    How can I get these images imported to this SharePoint list?
    Thanks,
    Paul
    Paul

    Hi Paul,
    Thanks for posting your issue, Kindlt run the below mentions script to get the profile picture in List view
    Update-SPProfilePhotoStore –MySiteHostLocation
    http://mysites –CreateThumbnailsForImportedPhotos
    $true
    Also, browse below mentioned URLs for more details on this
    http://technet.microsoft.com/en-us/library/ff607547.aspx
    http://blog.blumshapiro.com/blog/2013/05/13/adding-pictures-to-active-directory-and-show-in-sharepoint-2013/
    http://spsawyer.wordpress.com/2013/07/31/sharepoint-2013-user-profile-photo-sizes/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • Power Pivot 2013 Using SharePoint 2013 List as Source Data

    Background: On a SharePoint 2013 site, there are lists that have the exact same columns but due to their size I had to create a different list for each year.
    These are essentially my data lists or tables that end users enter data into. These lists have look up columns in them, referencing columns from look up lists or tables located on the same site.
    Goals:
    1) Create a Power Pivot Gallery on SharePoint 2013 that is able to leverage the "manage data refresh" feature using the SharePoint 2013 List data that is on the same SharePoint 2013 site.  
    2) Combine all the data lists/tables into one table once in Power Pivot 2013. The Look Up lists/tables will remain separate.
    Challenge: Being able to merge or do a union query to the "data lists" and still maintain the ability to leverage the "manage data refresh" feature. 
    This is a tactical, quick fix solution, and I
    cannot use SQL Server and am operating under the assumption that I do not have Access Services 2013 as an option.  
    Failed Attempt #1: What I already tried was linking the lists to an Access 2013 database and did a Union query from Power Pivot which merged the data from the different data tables
    as I wanted it to. Then I uploaded that Access Database to a document library on that same site, thinking that I could maintain the ability to leverage the "manage data refresh" feature but I was wrong.
    Any thoughts or suggestions? 
    Thanks in advance for any help!
    Cheers, Johnny
    Johnny

    You can connect to SharePoint Lists using Power Query (and of course Union multiple Lists and more using Pwer Query) - but Automatic refresh would not work with SharePoint. Power BI (Cloud service) allows auto refresh of Power Query, but not on SharePoint.
    Hopefully some day soon.
    Regards, Avi
    www.powerpivotpro.com
    Wiki:How to ask a Power Pivot Question to get a prompt, accurate and helpful response

  • When menu item is clicked i'm unable to call user form to my b1

    hi every one,
    i'm new to b1 sdk. i have written some code to handle menuevents. when an item on menu is clicked a form should open ...such that i have written some code which is shown below....but when i'm debugging ..after entering the control into createmysimpleform() it is not moving further....
    plz provide me some help in this regard...
    ======================================================================================================
    CODE
    ===================================================================================================
      Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
    =============================================================================================
            If (pVal.MenuUID = "SM_VID_F1") And (pVal.BeforeAction = true) Then
                SBO_Application.MessageBox("Rajender")
                If (pVal.MenuUID = "SM_VID_F1") And (pVal.BeforeAction = true) Then
                    SBO_Application.MessageBox("My first Menu was clicked")
                    CreateMySimpleForm() ' to call the user form for which the code is written in another sub program
                End If
            Else
                If (pVal.MenuUID = "SM_VID13") And (pVal.BeforeAction = False) Then
                    SBO_Application.MessageBox("My Second Menu was clicked")
                End If
            End If
    Private Sub CreateMySimpleForm()
            Dim oItem As SAPbouiCOM.Item
            '// we will use the following objects to set
            '// the specific values of every item
            '// we add.
            '// this is the best way to do so
            Dim oButton As SAPbouiCOM.Button
            Dim oStaticText As SAPbouiCOM.StaticText
            Dim oEditText As SAPbouiCOM.EditText
            Dim oComboBox As SAPbouiCOM.ComboBox
            '// add a new form
            Dim oCreationParams As SAPbouiCOM.FormCreationParams
            oCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
            oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
            oCreationParams.UniqueID = "MySimpleForm"
            oForm = SBO_Application.Forms.AddEx(oCreationParams)
            oForm.Visible = True
            '// add a User Data Source to the form
            oForm.DataSources.UserDataSources.Add("EditSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
            oForm.DataSources.UserDataSources.Add("CombSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
            '// set the form properties
            oForm.Title = "Simple Form"
            oForm.Left = 400
            oForm.Top = 100
            oForm.ClientHeight = 80
            oForm.ClientWidth = 350
            '// Adding Items to the form
            '// and setting their properties
            '// Adding an Ok button
            '// We get automatic event handling for
            '// the Ok and Cancel Buttons by setting
            '// their UIDs to 1 and 2 respectively
            oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 6
            oItem.Width = 65
            oItem.Top = 51
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Ok"
            '// Adding a Cancel button
            oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
            oItem.Left = 75
            oItem.Width = 65
            oItem.Top = 51
            oItem.Height = 19
            oButton = oItem.Specific
            oButton.Caption = "Cancel"
            '// Adding a Rectangle
            oItem = oForm.Items.Add("Rect1", SAPbouiCOM.BoFormItemTypes.it_RECTANGLE)
            oItem.Left = 0
            oItem.Width = 344
            oItem.Top = 1
            oItem.Height = 49
            '// Adding a Static Text item
            oItem = oForm.Items.Add("StaticTxt1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 7
            oItem.Width = 148
            oItem.Top = 8
            oItem.Height = 14
            oItem.LinkTo = "EditText1"
            oStaticText = oItem.Specific
            oStaticText.Caption = "Static Text 1"
            '// Adding another Static Text item
            oItem = oForm.Items.Add("StaticTxt2", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oItem.Left = 7
            oItem.Width = 148
            oItem.Top = 24
            oItem.Height = 14
            oItem.LinkTo = "ComboBox1"
            oStaticText = oItem.Specific
            oStaticText.Caption = "Static Text 2"
            '// Adding a Text Edit item
            oItem = oForm.Items.Add("EditText1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
            oItem.Left = 157
            oItem.Width = 163
            oItem.Top = 8
            oItem.Height = 14
            oEditText = oItem.Specific
            '// bind the text edit item to the defined used data source
            oEditText.DataBind.SetBound(True, "", "EditSource")
            oEditText.String = "Edit Text 1"
            '// Adding a Combo Box item
            oItem = oForm.Items.Add("ComboBox1", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
            oItem.Left = 157
            oItem.Width = 163
            oItem.Top = 24
            oItem.Height = 14
            oItem.DisplayDesc = False
            oComboBox = oItem.Specific
            '// bind the Combo Box item to the defined used data source
            oComboBox.DataBind.SetBound(True, "", "CombSource")
            oComboBox.ValidValues.Add("1", "Combo Value 1")
            oComboBox.ValidValues.Add("2", "Combo Value 2")
            oComboBox.ValidValues.Add("3", "Combo Value 3")
            '// set the form as visible
        End Sub

    hi satish, thanks for ur reply...
    i have 1 more doubt...plz try to solve this prob as soon as possible....
    i have created a user form with some lables and textboxes... and buttons...
    if i click on "adddata" button all the data i have entered in the form is inserted to DB...
    i have placed 1 more button ...so as to make already entered data in textboxes values empty.... but it is not working when i wrote the code below.....
    If (FormUID = "TestForm") And ((pVal.ItemUID = "13") And _
       (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And (pVal.BeforeAction = True)) Then
                Clear() ' this is update records with respect to code value entered in form to DB
            End If
    Public Sub Clear()
      oform.Items.Item("6").Refresh()
            oform.Items.Item("7").Refresh()
            oform.Items.Item("8").Refresh()
        End Sub
    is there any other method that is should call to clear the data...???

  • 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

  • How to force safari to open a new window when dock icon is clicked

    If Safari is already running on my MacBook Yosemite, and I click on the Safari icon in the dock, the Safari window is brought forward.  The behavior  I want is whenever I click the safari icon on the dock, is that a new safari browser window is opened.  I don't see this option in preferences (or any keyboard  mouse combination) that would make the dock icon open a new browser window.    (an option is available for new windows if you click on a hyperlink, but not if you click on the dock icon) .
    p.s. And I don't want to first  have to place focus on the current running safari and then click File New...too many steps when all I want is a new browser window
    Thanks in advance

    Hi css,
    Welcome to the Apple Support Communities!
    I understand that you would like to click on Safari in your Dock and have it open a new Safari Window. As you said in your post, clicking on Safari in the Dock brings the Safari window forward. There are a couple of possibilities to help resolve this situation. You can control-click (right click if enabled) on Safari in your Dock which will give you the option to open a new window. You can also click and hold on Safari, otherwise known as Press, to display these same options.
    Mac OS X: Additional features of the Dock - Apple Support
    Mouse clicks and key combinations for the Dock
    Control-click
    Reveals contextual menu for item. Menu choices vary per application or file. When used on Dock separator, it reveals Dock preferences. There you can turn magnification and hiding on or off, change the position of the Dock on screen, and change the minimization effect. Choose Dock Preferences to see more options.
    Press
    Reveals contextual menu for item. Menu choices vary per application or file.
    Cheers,
    Joe

  • Deleting a contact list item through Powershell in sharepoint 2010 synced with outlook 2010, does not delete the item from outlook.

    hi All,
    I have a requirement for updating the contact list from CSV file and updating/ adding and  deleting the changes in the SharePoint list using PowerShell script. List is also synced with outlook.
    The problem arises, when we delete an item from the list using PS, the item (which was earlier synced with outlook) is not getting deleted from outlook.
    Strange behavior : when we perform the same deletion operation manually from the SharePoint UI, every thing works fine as required.
    Please refer the below PS
    #Adding the records from SharePoint not in CSV file
    if($flag -ne 1)
    Get-Member -InputObject $csvRow -MemberType NoteProperty | ForEach-Object {
    $property = $_.Name
    $newItem.set_Item($property, $csvRow.$property)
    $newItem.Update()
    #Deleting the records from SharePoint not in CSV file
    CreatePSLog "Deleting the records from SharePoint not in CSV file"
    foreach($itm in $List.items)
    $del = 0
    $items | ForEach-Object {
    if($itm["SAP Ansprechpartnernr"] -eq $_."SAP Ansprechpartnernr")
    $del++;
    if(!$del)
    $List.GetItemById($itm.Id).Delete()
    $List.Update();
    $Web.Update();
    many thanks in advance, Please suggest as I am completly stuck on this :(
    Regards, Arun kumar

    Hi Kumar,
    Please remove the codeline $List.Update();, then run your code again, it works for me.
    You may need to firstly delete the synced contacts list within Outlook to remove those undeleted accounts, then re-connect the SharePoint contacts list to outlook, then run your modified Powershell code.
    Thanks
    Daniel Yang
    TechNet Community Support

Maybe you are looking for

  • Error while creating a view and creating navigation link

    Hi, i created one view with one button and on click of button it has to navigate to DeleteOperationview.This is the exception i am getting while running. can u plz tell me where the problem might beee... com.sap.tc.webdynpro.services.exceptions.Creat

  • Adding Updating Photo gallery in AS3?

    I am developing a IOS App in Flash cs5.I want to add a Photo gallery tab in the App.Which show below..need just like tat. http://i55.tinypic.com/1zzgcpk.jpg It must be able to update the picture from an website RSS link or an Picasa public album link

  • I can't open itunes 7.5, it hangs at setup wizard, can you stop this?

    I've just downloaded itunes 7.5. It goes through install, says it's installed correctly, then when I open itunes, it hangs at the itunes setup assistant. The setup step is "download album artwork". I can't click ok or cancel and the only way to get r

  • Smart playlists with video podcasts

    I have a smart playlist on my iPod with one rule: Video Kind is Movie When I play videos from this list I hear the audio, but the video is frozen on a frame. All videos work fine when played from the main Videos menu. Is anybody able to play video po

  • XML XPath Array Comma Deliminated....

    The following snippit of code works just fine. However I need to take the p2 array and rebuild it to an array that separates the values by a comma. I then can pass that into my SQL to support the Where In '1,2,3,' clause... String [] p2 = xPath.getVa