tags:

views:

85

answers:

3

Hi, am working on a project where I want to pull data from different lists in SharePoint and have these data imported into a single list. The list has the same attribute everywhere; it is located in different sites.

I have a list which contains all the site names and URL to those sites. The idea is to read from this list all the site names and then go to each one of those sites and try and pull the information from the list under that particular site, in synchronies matter. Data that are pulled from last week’s process do not need to be pulled again.

Can someone guide me in explaining what would be the best way to doing this solution?

Am using SharePoint 2007

A: 

You may be better off looking at the Data View Web Part (DVWP) and rollups

A common topic that is asked about in SharePoint, is how to roll up information from sub-sites to a top level site, and just generally how to show data from one site on another site.

Ryan
A: 
skyflyer
A: 

I have this scenario. I made a webpart that sends the information for my consolidation list, through the sharepoint web services. I installed the webpart in each sharepoint site, this webpart get the data (when it's outdated) and make a insert in the consolidation list through the lists.asmx webservice. See http://msdn.microsoft.com/en-us/library/lists(v=office.12).aspx. Then a I create a user with permission to write in the consolidation list in my consolidation site, and used this to authenticate my webpart when it will do the insert on the list.

I did something like this, in Visual Studio 2005, with Sharepoint dll referenced.

    public void InsertToPainel(string strID, string user, string password)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    try
                    {
//WSPainel is the WebReference to http://<site>/_vti_bin/Lists.asmx.
                        using (WSPainel.Lists lstPainel = new webPartSender.WSPainel.Lists())
                        {

                            lstPainel.UseDefaultCredentials = true;

                            lstPainel.Credentials = new System.Net.NetworkCredential(user, password);

                            #region Make the fields in consolidation list
                            Dictionary<string, string> fieldsNamesAndValues = new Dictionary<string, string>();

                            fieldsNamesAndValues.Add("ID", strID);//Recuperar quando for atualizar ou incluir New
                            fieldsNamesAndValues.Add("URL", SPContext.Current.Web.Url + ", " + splInfGerItems[0]["Title"].ToString()); //The link of the actual site that is sending the information
                            fieldsNamesAndValues.Add("Comments", splStatusItems[0]["Title"].ToString());//In my case, I just need the last result.

                            #endregion
                            //It will make the register in CAML format and updates the lists.
                            lstPainel.UpdateListItems(_listaPainel, NewCAMLRegister(fieldsNamesAndValues, strID));                            
                        }
                    }
                    catch (Exception e)
                    {
                       //Exception
                    }
                });
        }

     private XmlNode NewCAMLRegister(Dictionary<string, string> FieldsNamesAndValues, string strID)
        {
            try
            {
                XmlDocument xdMensagem = new XmlDocument();

                XmlElement xeBatch = xdMensagem.CreateElement("Batch");
                XmlNode xnMethod = xdMensagem.CreateElement("Method");


                xdMensagem.AppendChild(xeBatch);
                xeBatch.AppendChild(xnMethod);

                XmlAttribute xaID = xdMensagem.CreateAttribute("ID");
                XmlAttribute xaCmd = xdMensagem.CreateAttribute("Cmd");

                xaID.Value = "1"; //Id do comando no Batch.
                if (strID == "New")
                {
                    xaCmd.Value = "New";
                }
                else
                {
                    xaCmd.Value = "Update";
                }
                xnMethod.Attributes.Append(xaID);
                xnMethod.Attributes.Append(xaCmd);


                foreach (KeyValuePair<string, string> strfieldname in FieldsNamesAndValues)
                {
                    XmlNode xnField = xdMensagem.CreateElement("Field");
                    XmlAttribute xaName = xdMensagem.CreateAttribute("Name");
                    xaName.Value = strfieldname.Key;//Nome do Campo
                    xnField.Attributes.Append(xaName);
                    xnField.InnerText = strfieldname.Value;//Valor do Campo
                    xnMethod.AppendChild(xnField);                    
                }

                //"<Method ID=\"1\" Cmd=\"New\">" + "<Field Name=\"ID\">New</Field>" + "<Field Name=\"Title\">This is a test</Field>" + "</Method>";
                return xdMensagem;
            }
            catch (Exception e)
            {
                //Exception
                return null;

            }
        }

I hope it helps.

Guilherme J Santos