2010-06-11 3 views
2

SharePoint에서 다른 목록의 데이터를 가져 와서 이러한 데이터를 단일 목록으로 가져 오려는 프로젝트에서 작업하고 있습니다. 목록은 모든 곳에서 동일한 속성을가집니다. 다른 사이트에 있습니다.가변 사이트 명명을 기반으로 다른 사이트에서 SharePoint의 데이터를 통합

나는 모든 사이트 이름과 해당 사이트의 URL을 포함하는 목록을 가지고 있습니다. 아이디어는이 목록에서 모든 사이트 이름을 읽은 다음 해당 사이트의 각 사이트로 이동하여 해당 사이트 아래의 목록에서 정보를 가져오고 동기화해야합니다. 지난주의 프로세스에서 가져온 데이터는 다시 가져올 필요가 없습니다.

누군가이 솔루션을 수행하는 가장 좋은 방법을 설명하는 데 도움이 될 수 있습니까?

셰어를 사용하고 있습니까 2,007

답변

0

당신은 셰어에 대해 질문하는 Data View Web Part (DVWP) and rollups

일반적인 주제를보고 더 좋을 수는에 하위 사이트에서 정보를 롤업하는 방법입니다 정상 수준 위치, 및 다만 일반적으로 방법 는 다른 위치에 1 개의 위치에서 자료를 보여준다.

0

이 시나리오가 있습니다. 셰어 포인트 웹 서비스를 통해 내 통합 목록에 대한 정보를 보내는 웹 파트를 만들었습니다. 각 셰어 포인트 사이트에 webpart를 설치했습니다.이 웹 파트는 오래된 데이터 일 때 데이터를 가져 와서 lists.asmx 웹 서비스를 통해 통합 목록에 삽입합니다. http://msdn.microsoft.com/en-us/library/lists(v=office.12).aspx을 참조하십시오. 그런 다음 통합 사이트의 통합 목록에 쓸 수있는 권한을 가진 사용자를 만들고 목록에 삽입 할 때 내 웹 파트를 인증하는 데 사용했습니다.

Visual Studio 2005에서 Sharepoint dll을 참조하여이 작업을 수행했습니다.

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; 

      } 
     } 

도움이되기를 바랍니다.

관련 문제