Help with Joining two SharePoint lists using LINQ

Hi Guys,
I have found many threads with this question. Although I had one doubt. I wanted to know that while performing a Join operation on two SharePoint Lists using LINQ does the column on which we are performing the join operation need to be a Lookup column?
I was initially using CAML but since my lists does not contain lookup columns I switched to LINQ but my doubt still remains.
I would really appreciate any help from you guys and also would appreciate if I could get some examples that I could refer to.
Thank you

Joins in LINQ to SharePoint 2010
How to: Query Using LINQ to SharePoint
This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

Similar Messages

  • Help with joining two queries

    Hi
    We recently inherited a database and we are re-wrting some queries. The first is
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC, aggDataC.DATA as Capacity, aggDataP.DATA as Production
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT
    gu, AGGREGATED_DATA aggDataC, AGGREGATED_DATA aggDataP
    WHERE      gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND aggDataC.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataC.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataC.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataC.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataC.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataC.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataC.PLANT_TYPE_ID))
    AND aggDataC.ORGANISATION_ID is NULL
    AND aggDataC.YEAR = :Year
    AND aggDataC.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'CAP')
    AND aggDataC.STAT_PERIOD_TYPE_ID = :StatPeriodTypeId
    AND aggDataP.GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    AND ((:CommodityGroupId IS NULL AND
    aggDataP.COMMODITY_GROUP_ID IS NULL) OR (:CommodityGroupId = aggDataP.COMMODITY_GROUP_ID))
    AND ((:CommodityTypeId IS NULL AND
    aggDataP.COMMODITY_TYPE_ID IS NULL) OR (:CommodityTypeId = aggDataP.COMMODITY_TYPE_ID))
    AND ((:PlantTypeId IS NULL AND aggDataP.PLANT_TYPE_ID
    IS NULL) OR (:PlantTypeId = aggDataP.PLANT_TYPE_ID))
    AND aggDataP.ORGANISATION_ID is NULL
    AND aggDataP.YEAR = :Year
    AND aggDataP.STAT_TYPE_ID = (SELECT stat_type_id FROM
    stat_type WHERE stat_type = 'PRD')
    The above query returns only the geographic units that have capacity and production figures.
    I want to return all other regions that have a plantypeid regardless of whether they have capacity and production data.
    I tried to use outer joins but this has not worked. The database is an oracledatabase
    the below query returns all the geographic regions I need
    SELECT gu.GEOGRAPHIC_UNIT_ID, gu.GEOGRAPHIC_UNIT_DESC
    FROM GEOGRAPHIC_UNIT_RELATIONSHIP gur, GEOGRAPHIC_UNIT gu
    where
    gur.PARENT_GEOGRAPHIC_UNIT_ID = :geographicUnitId
    AND gur.CHILD_GEOGRAPHIC_UNIT_ID = gu.GEOGRAPHIC_UNIT_ID
    ANy idea how I merge the 2 queries?

    UNION

  • Merging two SharePoint lists

    Hello !
    I have 2 SharePoint lists for years 2013 and 2014. I want to merge them and then pull the merged list into PowerPivot. I appreciate any help for that. I don't want to have 2 lists in PowerPivot, so I was wondering if there is anyway that I can merge these
    2 SharePoint lists?
    --update--
    I need to have live connection between the lists.  It means I want to have an automated process in place that can merge two lists once I pulled them into PowerPivot without any manual process of merging the lists.

    I don't know what rights you need to do this, but go to each site and do the following instructions:
    Click on Site Actions
    Click Site Settings
    Click Manage All Site Settings
    Under the Site Administration Group, click Content and Structure
    A window comes up that looks like Window's File Manager. You are in the current site, but you can see that you can browser to other sites in your site collection from the left panel.
    Locate the list you want to copy items from and click the name. You will see all the items, or at least in pages of 100.
    Change the paging quantity from 100 to 1000 in the top right, where it says "Show 100".
    Select all the items you want to copy. There's an icon that looks like a stack of papers, to select all items on this page.
    Click Actions in the toolbar, then click "Copy...". A dialog will come up of the current site collection.
    Choose the destination then, click Ok.
    Repeat this until you're done copying all items from the list.
    Be patient while the copy process completes, then switch to the other 49 sites. You cannot copy from one site collection to another. You can copy between
    subsites or sister sites. If you can't see the Content and Structure link in the Site Settings page, use the 12 hive URL: http://sitecollection/_layouts/sitemanager.aspx You'll
    have the items copied in no time without the help of IT/development.
    Courtesy links
    http://stackoverflow.com/questions/17956557/combine-multiple-sharepoint-lists-into-one
    https://www.nothingbutsharepoint.com/2012/05/11/how-to-link-two-lists-and-create-a-combined-view-in-sharepoint-2010-aspx/
    http://sharepoint.stackexchange.com/questions/34198/combining-multiple-lists-into-one
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/bcd2f069-ceec-42df-8989-a03e0cb017f3/to-join-two-sharepoint-list-having-a-common-colomn-without-using-joins?forum=sharepointgeneralprevious
    please 'Propose as answer' if it help you, also vote this as helpful if you like this reply.

  • SSRS reporting with sharepoint list using Distinct and Multivalue parameters

    i want create ssrs report with sharepoint list using ms-vs(2008). i want create Distinct multivalue parameters by using CAML query. There is any way we put CAML query where we use Distinct keyword and IN clause in CAML query... i hope all experts will
    understand my poor English... sorry for poor English.. plz help me

    Hi AsifMehmood,
    Per my understanding you have create an SSRS report with SharePoint list, now you don’t know to create the distinct parameters by using CAML query,  right?
    For the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results, but we can use the custom code to do this function. I have tested on my local environment and we can do that by create one hidden parameter(Param1)
    to get all the values from the fields which will  add the filter and then create another parameter(Param2) to get the distinct values based on the Param1, we use the custom code to do the deduplication.
    Step by Steps information in below thread for your reference to create the parameters and the custom code:
    "How to get distinct values of sharepoint column using SSRS"
    Other similar thread for your reference:
    https://audministrator.wordpress.com/2014/02/17/sharepoint-list-add-distinct-parameter-value/
    If your problem still exists, please feel free to ask and also try to provide us more details information.
    Regards
    Vicky Liu

  • How do I query a SharePoint List using a url and filtering on date?

    I am reading a SharePoint list using jquery.  Everything is working fine
    except for the filter.  Each list item has an expiration date.  I want to retrieve JUST the items that have not expired (Expires > Today) but I can't figure out the url syntax and I've been searching all day for an example and
    can't find one.  Could someone please help?!?  See bold code below.
    Thanks,
    Glen
    $(document).ready(function ()
    <strong>var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
    </strong> $.getJSON(qryWCFUrl, function (results)
    $.each(results.d.results, function (i, mmAlert)
    itemID = mmAlert.Id;
    mmTitle = mmAlert.Title;
    mmClass = mmAlert.ClassValue;
    //alert("Item="+itemID+" Title="+mmTitle+" Class="+mmClass);
    AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);

    Fadi,
    Thanks for your response.  I actually have another version of the code that uses the SP client objects that works.  The problem is site boundries.  Let me give a more complete project explanation.
    I am creating a master page for a new intranet.  As part of this master page, I want to read from an SP list of alerts and post each alert (if not expired) in the SP status bar.  I've gotten this to work with SP client objects and jquery (except
    for the date filter part).  Both of these solutions work fine on the top site level.  BUT when trying it out at the sub-site level, the SP client objects version of my code fails. The jQuery version works except the date filtering.
    I looked at the example from your link and it looks like a bit of a hybrid to my approaches:  JQuery with CAML.  My question is; does this example permit me to access a list in the top-level site from the subsites?  Please excuse my ignorance,
    but I am an EXTREME newbie in this having spent the past 8 years as a VB.Net developer and a little bit of ASP.Net.
    Below are the two different versions of my code in different versions of my master page definition:
    SP Client Object Version
    <script type="text/javascript">
    // <![CDATA[
    ExecuteOrDelayUntilScriptLoaded(LoadAlerts, "sp.js");
    var ctx;
    var currAlerts;
    function LoadAlerts() {
    ctx = new SP.ClientContext.get_current();
    list = ctx.get_web().get_lists('/sites/MMTP1/Lists/').getByTitle('MMAlerts');
    var cmlQry = new SP.CamlQuery();
    var camlExp = '<query><Query><Where><Gt><FieldRef Name="Expires" /><Value IncludeTimeValue="FALSE" Type="DateTime"><Today /></Value></Gt></Where></Query></query>';
    cmlQry.set_viewXml(camlExp);
    currAlerts = list.getItems(cmlQry);
    ctx.load(currAlerts,'Include(ID,Title,Class)');
    ctx.executeQueryAsync(GetAlertsSuccess,GetAlertsFailed);
    function GetAlertsSuccess() {
    var lstEnum = currAlerts.getEnumerator();
    while(lstEnum.moveNext()) {
    var mmAlert = lstEnum.get_current();
    AddMMStatus(mmAlert.get_item('ID'),mmAlert.get_item('Title'),mmAlert.get_item('Class'));
    function GetAlertsFailed(sender,args) {
    alert('Alerts load failed: ' + args.tostring);
    function AddMMStatus(msgID, strTitle, strClass) {
    var statID;
    var statClass;
    var statTitle;
    statClass = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a>";
    statTitle = "<a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a>";
    statID = SP.UI.Status.addStatus(statClass, statTitle, true);
    SP.UI.Status.setStatusPriColor(statID,"red");
    function DisplayAlert(msgID) {
    var options = {
    title: "Miller & Martin Alert!",
    url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
    allowMaximize: false,
    showClose: true
    SP.UI.ModalDialog.showModalDialog(options);
    // ]]>
    </script>
    JQuery Version (works except for filtering by date)
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" >
    // <![CDATA[
    var itemID;
    var mmTitle;
    var mmClass;
    $(document).ready(function ()
    var qryWCFUrl = "/sites/MMTP1/_vti_bin/listdata.svc/MMAlerts?$filter=(Expires gt '08/10/2011')&$orderby=Title";
    $.getJSON(qryWCFUrl, function (results)
    $.each(results.d.results, function (i, mmAlert)
    itemID = mmAlert.Id;
    mmTitle = mmAlert.Title;
    mmClass = mmAlert.ClassValue;
    AddMMStatus(mmAlert.Id,mmAlert.Title,mmAlert.ClassValue);
    function AddMMStatus(msgID, strTitle, strClass, strSeverity) {
    var statID;
    var statClass;
    var statTitle;
    statClass = "<div id=\"mmAlertTitle\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strClass + ": </a></div>";
    statTitle = "<div id=\"mmAlertDetail\" style=\"display:inline-block;\"><a href=\"#\" onclick=\"javascript:DisplayAlert("+msgID+");\">" + strTitle + "</a></div>";
    statID = SP.UI.Status.addStatus(statClass, statTitle, true);
    SP.UI.Status.setStatusPriColor(statID,"green");
    function DisplayAlert(msgID) {
    var options = {
    title: "Miller & Martin Alert!",
    url: "/sites/MMTP1/SitePages/ShowAlert02.aspx?ID="+msgID,
    allowMaximize: false,
    showClose: true
    SP.UI.ModalDialog.showModalDialog(options);
    // ]]>
    </script>

  • How to update an existing item in a sharepoint list using the WSS adapter for Biztalk

    Is there a way that a record in SP list be updated using WSS adapter in biztalk ?
    BizTalk 2013 and SP 2013 ..
    Regards
    Ritu Raj
    When you see answers and helpful posts,
    please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    A ListItem has its own unique row id so in all likelihood, an insert with the same data will result in a new list entry. The Lists Web Service however, has an UpdateListItem method which will take an update request. [refer
    http://msdn.microsoft.com/en-us/library/office/websvclists.lists.updatelistitems(v=office.15).aspx ]
    There is another note in the conference (marked answered) to your List Item Update problem. Probably worth a try too. [refer
    http://social.msdn.microsoft.com/Forums/en-US/bee8f6c6-3259-4764-bafa-6689f5fd6ec9/how-to-update-an-existing-item-in-a-sharepoint-list-using-the-wss-adapter-for-biztalk?forum=biztalkgeneral ]
    Regards.

  • How to Enable Ratings on SharePoint List using Client Object Model for Office 365 SharePoint Site.

    How to Enable Ratings on SharePoint List using Client Object Model code for Office 365 SharePoint Site.
    Thanks in Advance
    Rajendra K

    Hi Rajendra,
    here you are the code and the blog, let me know if this helps
    using (ClientContext ctx = new ClientContext(https://yourSiteUrl))
    Web w = ctx.Web;
    List l = w.Lists.GetByTitle("yourListName");
    ctx.Load(l, info => info.Id);
    ctx.ExecuteQuery();
    string ListID = l.Id.ToString();
    Microsoft.Office.Server.ReputationModel.Reputation.SetRating(ctx, ListID, 1, 5);
    ctx.ExecuteQuery();
    http://blogs.technet.com/b/speschka/archive/2013/07/08/how-to-use-csom-with-ratings-in-sharepoint-2013.aspx
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation

  • Check duplicate items in two sharepoint lists

    Hi, I have 2 separate sharepoint lists, both contrain user names. e.g: Jan Jaap.
    I want sharepoint to automaticly compare those lists to see if there is any name in both lists and notify me about it. For example :
    List 1: Firstname | Surname
              Jan           -    Jaap
              Steen        -    Vos
              george       -    bush
    List 2: Firstname | Surname
              Jan           -    Jaap
              fox            -    washington
              brian         -    potter
    both lists contain jan jaap. and i want sharepoint to notice that and send me and email about it :p.
    Is this in any way possible?
    Thanks in advance!!

    You can use below tool
    http://www.metalogix.com/help/Content%20Matrix%20Console/SharePoint%20Edition/002_HowTo/004_SharePointActions/003_CompareSitesAndLists.htm
    Or if you want to do it programmatic try below:
    http://sharepoint.stackexchange.com/questions/60917/compare-items-of-two-sharepoint-lists
    SPWeb web = SPContext.Current.Web;
    SPList list = web.Lists["Employee"];
    string query = @"<Where>
    <Eq>
    <FieldRef Name='Position' /><Value Type='Choice'>{0}</Value>
    </Eq>
    </Where>
    <OrderBy>
    <FieldRef Name='Salary' Ascending='False' />
    </OrderBy>";
    query = string.Format(query, "Developer");
    SPQuery spQuery = new SPQuery();
    spQuery.Query = query;
    SPListItemCollection items = list.GetItems(spQuery);
    If this helped you resolve your issue, please mark it Answered

  • Split a text based on delimiter and add items to a sharepoint list using SPD workflow

    Hi All
    I have to store repeating table data into a sharepoint list. I have developed an approach to store data into a sharepoint list using web services as mentioned at
    http://www.bizsupportonline.net/infopath2007/how-to-submit-items-rows-repeating-table-infopath-sharepoint-list.htm. However this approach is working when form opened client only but when I opened it in browser this approach is giving error. Now I'm looking
    to promote repeating table data by combining items will a delimiter semi-colon (;). Please let me know how can I split the promoted field value using de-limiter and add it to a sharepoint list.
    Note:
    I'm working on SharePoint online 2010. (I don't have sharepoint on-premise, so I can't use SharePoint Object Model)
    If anybody know how to deal with this, please let me know.
    Thank you in advance.

    Hi Chuchendra,
    According to your description, my understanding is that you want to split the promoted field value in InfoPath form which was combined using semi-colon and add it to a SharePoint list.
    I recommend to submit the data to another SharePoint list first(use a column to store the value) and then create calculated columns to user formula to split the value, then use workflow to update the list where you want to add the value with the divided
    values.
    For example: the value is aa;bb;cc;dd.
    Based on the number of the semi-colons, we need to create one column to store the original value(named test for example), four calculated columns(v1,v2,v3,v4) to store the divided values and two more calculated columns(flag1,flag2) for use in the formula.
    v1: =LEFT([test],FIND(";",[test])-1)
    flag1: =RIGHT([test],LEN([test])-FIND(";",[test]))
    v2: =LEFT([flag1],FIND(";",[flag1])-1)
    flag2: =RIGHT([flag1],LEN([flag1])-FIND(";",[flag1]))
    v3: =LEFT([flag2],FIND(";",[flag2])-1)
    v4: =RIGHT([flag2],LEN([flag2])-FIND(";",[flag2]))
    We can also use Client Object Model to write code to split the value of the field.
    You can download the dll files form the link below:
    http://www.microsoft.com/en-in/download/details.aspx?id=21786
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • I need help with controlling two .swf's from third.

    Hi, thanks for reading!
    I need help with controlling two .swf's from third.
    I have a problem where I need to use a corporate designed
    .swf in a digital signage solution, but have been told by the legal
    department that it can not be modified in any way, I also can't
    have the source file yada yada. I pulled the .swfs from their
    website and I decompiled them to see what I was up against.
    The main swf that I need to control is HCIC.swf and the
    problem is it starts w/ a preloader, which after loading stops on a
    frame that requires user input (button press) on a play button,
    before the movie will proceed and play through.
    What I have done so far is to create a container swf,
    HCIC_container.swf that will act as Target for the HCIC.swf, and
    allow me to send actionscript to the file I'm not allowed to
    modify.
    I managed to get that done with the help of someone on
    another forum. It was my hope that the following script would just
    start HCIC.swf at a frame past the preloader and play button, and
    just play through.
    var container:MovieClip = createEmptyMovieClip("container",
    getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("MCIC.swf", container);
    function onLoadInit(mc:MovieClip) {
    mc.gotoAndPlay(14);
    But unfortunately it didn't solve my problem. Because there
    is a media-controller.swf, that is being loaded by HCIC.swf that
    has the controls including the play button to start HCIC.swf.
    Here's a link to a .zip file with all 3 .swf files, and all 3
    .fla files.
    http://www.axiscc.com/temp/HCIC.zip
    What I need to do is automatically start the HCIC.swf file
    bypassing the pre-loader and play button without editing it or the
    media-controller.swf in anyway. So all the scripting needs to be
    done in HCIC_container.swf.
    I know this is confusing, and its difficult to explain, but
    if you look at the files it should make sense.
    ActionScripting is far from my strong point, so I'm
    definitely over my head here.
    Thanks for your help.

    Got my solution on another forum.
    http://www.actionscript.org/forums/showthread.php3?t=146827

  • Can anyone help me display the calendar list using an iphone4 wit iso 7.1.1?  I have already tried tapping the magnifying glass and that doesn't work.

    Can anyone help me display the calendar list using an iphone4 with iso 7.1.1?  I have already tried tapping the magnifying glass and that doesn't work.

    That icon allows for the calendar month to display with the appts for that month below.  I want to see only the list of appointments without the month displaying.  I use to be able to get that display but since the last update tapping the magnifiying glass doesn't work.

  • Get particular item count in sharepoint list using designer Workflow

    How to get specific item count in sharepoint list using designer Workflow 2013.
    For Example 
    Title  Count
    x        1
    y        1
    x        2
    x        3

    HI Thiru,
    Can you please elaborate your problem. Is that Title and count are your list columns you want to fetch the value of count column based on title?
    If my interpretation in not wrong, then it's not possible in SPD with the case you have mentioned in your question as Title='x' is having 3 different entries and SPD activity will always return first matching item and ignore the rest with warning message.
    Regards,
    Brij K

  • I need help with these two crash IDs nsStyleContext::FindChildWithRules(nsIAtom const*, nsRuleNode*) and DFusionWebPlugin@0x86b5

    I need help with these two crashes...
    PL_DHashTableOperate | GCGraphBuilder::NoteRoot(unsigned int, void*, nsCycleCollectionParticipant*)
    DFusionWebPlugin@0x86b5
    The first one happened a couple of days ago, a few times and not on any specific website.
    The second one only happens on the site below.

    The second one indicates a problem with the DFusionWebPlugin that shows in your More system details list.
    # D'Fusion Web Plug-In for Safari 64 bits (3.00.13774.0)
    # D'Fusion Web Plug-In (3.00.13774.0)
    What you posted are crash signatures.<br />
    It might help if you post the actual crash IDs (bp-xxxxxxxx-xxxxxxxxx-xxxx-xxxxxxxxxxxx).<br />
    You can find the IDs of the submitted crash reports on the <i>about:crashes</i> page.
    See http://kb.mozillazine.org/Breakpad (Mozilla Crash Reporter)

  • I have huge lag with Safari's Reading List using a rMBP. I have probably 80 articles saved, which is likely the cause of the lag. Is there any way to export that list of articles so as to be able to delete them from Reading List but still have a record?

    I have huge lag with Safari's Reading List using a rMBP. I have probably 80 articles saved, which is likely the cause of the lag. Is there any way to export that list of articles so as to be able to delete them from Reading List but still have a record of the articles I intend to read?

    I'm currently dealing with this issue myself, except that my rMBP has NO articles in the reading list.  It's a brand new rMBP too, purchased just this week, with the 2.6 Ghz Processor & 16GB of RAM.
    Let's see what we can find.  I may just take it back to the Apple Store.

  • Excel 2010 Synchronize List with SharePoint List using VBA

    I have used and loved the interaction between Excel and SharePoint for many generations of both solutions.  It's a wonderful opportunity to integrate the familiarity and simplicity of Excel (formatting, ease of use, availability) with the data storage
    and centralized list capabilities of SharePoint.  Right?
    When upgrading to Excel 2010, I have noticed with much dismay that much of the inherent easy to use features of previous versions were effectively stripped from this newest version.  Much research, time and energy has been spent working around and resolving
    the deficiency.  One Microsoft based article,
    http://support.microsoft.com/kb/930006, has provided the mechanics behind utilizing the "hidden" functionality... although, this capability to use VBA to create the synchronized list was available in previous versions.  However, once Microsoft
    published this article to this "hidden" functionality... I feel that the behavior should be supported by Microsoft in some way.  OK?
    Revised instructions to reproduce the problem:
    1. Create a SharePoint list with 20 dummy records.
    - Note the List Name  ##LIST_NAME##
    - Note the View GUID  ##VIEW_GUID##
    - Note SharePoint Base URL  ##BASE_URL##
    2. REVISED... In Excel 2010, save the file as Compatible "Excel 97-2003 Workbook".  Close the file and reopen.  Create a connected table (ListObject) in Excel using the article above to the SharePoint list.  Use Sample VBA code
    below:
    Sub LinkedSharePointList()    
    ActiveSheet.ListObjects.Add SourceType:=xlSrcExternal,_
        Source:=Array(##BASE_URL## & "/_vti_bin", ##LIST_NAME##, _
        ##VIEW_GUID##), LinkSource:=True, Destination:=Range("A1")
    End Sub
    3. OOPS REVISED this item.  The problem is actually with ROW 21... So, update record on row 21... (no matter where the table is located... (if the "Destination" is "A1", then the problem is with ID=20, but if the Table is
    shifted down to say A12, then ID=9 on row 21).  Anyway... make a simple change to that record... and you'll see the ID immediately change.... as if it's a NEW record.  WEIRD!  Note: If the sheet is protected, then an error is displayed
    indicating that a "read-only" record cannot be updated (referring to the ID cell in column A for the current row). 
    4. Now "synchronize" the list with excel.  The former record is still in the list unchanged AND there is a NEW record in the list holding the changes.  There are a number of problems that seem to ONLY occur when something changes to ROW
    21.... Next, try to copy/paste multiple records across multiple rows that intersect with ROW 21.  Yikes!! 
    I look forward to hearing others' experience!
    Thanks!
    Mark

    Here are some things that you can try (change the code, where appropriate):
    Private Sub CreateList()
        Dim folder As folder
        Dim f As File
        Dim fs As New FileSystemObject
        Dim RowCtr As Integer
        RowCtr = 1
        Set folder = fs.GetFolder("http://excel-pc:43231/Shared Documents/Forms/") '<=Variable Location
        For Each f In folder.Files
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        Next f
    End Sub
    Sub ListAllFile()
     Dim objFSO As Object
     Dim objFolder As Object
     Dim objFile As Object
     Dim pth As String
     Dim WBn As Workbook
     Dim ObCount As Long
     Dim FileNme As String
     Application.ScreenUpdating = False
     Set objFSO = CreateObject("Scripting.FileSystemObject")
     'Get the folder object associated with the directory
     Set objFolder = objFSO.GetFolder("\\excel-pc:43231\Shared Documents\Forms\")
    '** You'll need to specify your path here. By removing the http: from the path, the code liked it & found the folder. It wasn’t working previously ***
     pth = "http://excel-pc:43231/Shared Documents/Forms/"
    '** You'll need to specify your path here. The reason I’ve done this separately is because the path is not recognised otherwise when trying to specify it with workbook.open & using the value set for objFolder **
     ObCount = objFolder.Files.Count
    '** counts the number of files in the folder
     'Loop through the Files collection
     For Each objFile In objFolder.Files
     Nm1 = Len("http://excel-pc:43231/Shared Documents/Forms/")
    '** You'll need to specify your path here **
     Nm2 = Len(objFile) - Nm1
     FileNme = Right(objFile, Nm2)
    '** I’ve done this part to find out/set the file name**
     Set WBn = Workbooks.Open(pth & FileNme, , , , Password:="YourPassword")
    '** opens the first file in the library – if there is no password, the remove everything from - , , , , Password:="Password1" – leaving the close bracket ‘)’
     Application.ScreenUpdating = False
    '** optional – you can leave the screen updating on
    '<< Your coding here>>
    '** The file is now open. Enter whatever code is specific to your spreadsheets.
     Next
    '** goes to next file within your sharepoint folder
    End Sub
    Sub SharePoint()
    Dim xlFile As String, xlFullFile As String
    Dim xlApp As Excel.Application
    Dim wb As Workbook
    xlFile = "\\excel-pc:43231\Shared Documents"
    'http://excel-pc:43231/Shared Documents/
    '****----denotes the path.(i.e) u give the path as windows search.Don't use "\" at the end.
    'In the sharepoint path %20 denotes space.so u remove that and use space .
    Set xlApp = New Excel.Application
    xlApp.Visible = True
    xlFullFile = GetFullFileName(xlFile, "Book") 'ANZ denotes starting characters of the file.
    xlFile = xlFile & "\" & xlFullFile
    Set wb = xlApp.Workbooks.Open(xlFile, , False)
    'Once the workbook is opened u can do ur code here
    wb.Close False
    End Sub
    Function GetFullFileName(strfilepath As String, _
    strFileNamePartial As String) As String
    Dim objFS As Variant
    Dim objFolder As Variant
    Dim objFile As Variant
    Dim intLengthOfPartialName As Integer
    Dim strfilenamefull As String
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFS.GetFolder(strfilepath)
    'work out how long the partial file name is
    intLengthOfPartialName = Len(strFileNamePartial)
    For Each objFile In objFolder.Files 'Instead of specifying the starting characters of the file you can directly loop through all files in the folder .
    'Test to see if the file matches the partial file name
    If Left(objFile.Name, intLengthOfPartialName) = strFileNamePartial Then
    'get the full file name
    strfilenamefull = objFile.Name
    Exit For
    Else
    End If
    Next objFile
    Set objFolder = Nothing
    Set objFS = Nothing
    'Return the full file name as the function's value
    GetFullFileName = strfilenamefull
    End Function
    Sub SrchForFiles()
    ' Searches the selected folders and sub folders for files with the specified (xls) extension.
    'ListTheFiles 'get the list of all the target XLS files on the SharePoint Directory
    Dim i As Long, z As Long, Rw As Long, ii As Long
    Dim ws As Worksheet, dd As Worksheet
    Dim y As Variant
    Dim fldr As String, fil As String, FPath As String
    Dim LocName As String
    Dim FString As String
    Dim SummaryWB As Workbook
    Dim SummaryWS As Worksheet
    Dim Raw_WS As Worksheet
    Dim LastRow As Long, FirstRow As Long, RowsOfData As Long
    Dim UseData As Boolean
    Dim FirstBlankRow As Long
    'grab current location for later reference, for where to paste final data
    Set SummaryWB = Application.ActiveWorkbook
    Set SummaryWS = Application.ActiveWorkbook.ActiveSheet
    y = "xls"
    fldr = "\\excel-pc:43231\Shared%20Documents\Forms\AllItems.aspx"
    FirstBlankRow = 2
    'asd is a 1-D array of files returned
    asd = ListFiles(fldr, True)
    Set ws = Excel.ThisWorkbook.Worksheets(1) 'list of files
    ws.Activate
    ws.Range("A1:Z100").Select
    Selection.Clear
    On Error GoTo 0
    For ii = LBound(asd) To UBound(asd)
    Debug.Print Dir(asd(ii))
    fil = asd(ii)
    'open the file and grab the data
    Application.Workbooks.Open (fil), False, True
    'Get file path from file name
    FPath = Left(fil, Len(fil) - Len(Split(fil, "\")(UBound(Split(fil, "\")))) - 1)
    'Get file information
    If Left$(fil, 1) = Left$(fldr, 1) Then
    If CBool(Len(Dir(fil))) Then
    z = z + 1
    ws.Cells(z + 1, 1).Resize(, 6) = _
    Array(Dir(fil), LocName, RowsOfData, Round((FileLen(fil) / 1000), 0), FileDateTime(fil), FPath)
    DoEvents
    With ws
    .Hyperlinks.Add .Range("A" & CStr(z + 1)), fil
    '.FoundFiles(i)
    End With
    End If
    End If
    'Workbooks.Close 'Fil
    Application.CutCopyMode = False 'Clear Clipboard
    Workbooks(Dir(fil)).Close SaveChanges:=False
    Next ii
    With ws
    Rw = .Cells.Rows.Count
    With .[A1:F1]
    .Value = [{"Full Name","Location","Rows of Data","Kilobytes","Last Modified", "Path"}]
    .Font.Underline = xlUnderlineStyleSingle
    .EntireColumn.AutoFit
    .HorizontalAlignment = xlCenter
    End With
    .[G1:IV1 ].EntireColumn.Hidden = True
    On Error Resume Next
    'Range(Cells(Rw, "A").End(3)(2), Cells(Rw, "A")).EntireRow.Hidden = True
    Range(.[A2 ], Cells(Rw, "C")).Sort [A2 ], xlAscending, Header:=xlNo
    End With
    End Sub
    Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _
    As String()
    Dim fso As New Scripting.FileSystemObject
    Dim fld As Scripting.folder
    Dim fileList As String
    ' get the starting folder
    Set fld = fso.GetFolder(Path)
    ' let the private subroutine do all the work
    fileList = ListFilesPriv(fld, NestedDirs)
    ' (the first element will be a null string unless the first ";" is removed)
    fileList = Right(fileList, Len(fileList) - 1)
    ' convert to a string array
    ListFiles = Split(fileList, ";")
    End Function
    ' private procedure that returns a file list
    ' as a comma-delimited list of files
    Function ListFilesPriv(ByVal fld As Scripting.folder, _
    ByVal NestedDirs As Boolean) As String
    Dim fil As Scripting.File
    Dim subfld As Scripting.folder
    ' list all the files in this directory
    For Each fil In fld.Files
    'If UCase(Left(Dir(fil), 5)) = "MULTI" And fil.Type = "Microsoft Excel Worksheet" Then
    If fil.Type = "Microsoft Excel Worksheet" Then
    ListFilesPriv = ListFilesPriv & ";" & fil.Path
    Debug.Print fil.Path
    End If
    Next
    ' if requested, search also subdirectories
    If NestedDirs Then
    For Each subfld In fld.SubFolders
    ListFilesPriv = ListFilesPriv & ListFilesPriv(subfld, NestedDirs)
    Next
    End If
    End Function
    Finally . . .
    Sub ListFiles()
        Dim folder As Variant
        Dim f As File
        Dim fs As New FileSystemObject
        Dim RowCtr As Integer
        Dim FPath As String
        Dim wb As Workbook
        RowCtr = 1
        FPath = "http://excel-pc:43231/Shared Documents"
        For Each f In FPath
        'Set folder = fs.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
        'For Each f In folder.Files
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        Next f
    End Sub
    Sub test()
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFolder = objFSO.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
        'Set colSubfolders = objFolder.SubFolders
        'For Each objSubfolder In colSubfolders
           Cells(RowCtr, 1).Value = f.Name
           RowCtr = RowCtr + 1
        'Next
    End Sub
    Ryan Shuell

Maybe you are looking for