Example #1
0
        static void Main()
        {
            FunnelbackXmlConfig fbx = new FunnelbackXmlConfig();
            fbx.outputFolder = @"C:\Users\rpfmorg\output";
            fbx.targetSite = @"http://funnelback.sharepoint.com/teamsite/";
            fbx.WantedFields = new string[] {"WikiField", "FileRef", "FileDirRef", "FileLeafRef", "Created", "Modified"};
            fbx.CDataFields =  new string[] {"WikiField"};
            fbx.LookupFields = new string[] {"Author"};

            using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(fbx.targetSite))
            {
                if (ctx != null)
                {
                    using (StreamWriter writer = new StreamWriter(fbx.outputFolder + "\\first.xml"))
                    {
                        Site oSite = ctx.Site;
                        WebCollection oWebs = oSite.RootWeb.Webs;
                        FunnelbackXmlSite fbxs = new FunnelbackXmlSite();
                        fbxs.ww = oSite.RootWeb;
                        fbxs.myfbx = fbx;
                        fbxs.Process();
                        ctx.Load(oWebs);
                        ctx.ExecuteQuery();
                        writer.WriteLine(@"<?xml version='1.0'?>");
                        writer.WriteLine(@"<sharepoint>");
                        foreach(Web oWebsite in oWebs)
                        {

                            ListCollection collList = oWebsite.Lists;
                            ctx.Load(collList); // Query for Web
                            ctx.ExecuteQuery(); // Execute

                            writer.WriteLine(@"<site>");
                            writer.WriteLine("<title>{0}</title>", oWebsite.Title);
                            foreach (List oList in collList)
                            {
                                writer.WriteLine("<list>{0}</list>", oList.Title);
                                List oListy = collList.GetByTitle(oList.Title);
                                CamlQuery camlQuery = new CamlQuery();
                                camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";
                                ListItemCollection collListItem = oListy.GetItems(camlQuery);
                                ctx.Load(collListItem,
                                         items => items.IncludeWithDefaultProperties(
                                         	item => item.DisplayName,
                                         	item => item.HasUniqueRoleAssignments
                                         ));
                                ctx.ExecuteQuery();
                                foreach (ListItem oListItem in collListItem)
                                {
                                    FunnelbackXmlRecord oFXR = new FunnelbackXmlRecord();
                                    oFXR.myfbx = fbx;
                                    oFXR.li = oListItem;
                                    oFXR.FunnelbackWriteXml();
                                }
                            }
                            writer.WriteLine(@"</site>");
                        }
                        writer.WriteLine(@"</sharepoint>");
                    }
                }
            }
        }
Example #2
0
 public void Process()
 {
     if (this.ww != null)
     {
         WebCollection oWebs = this.ww.Webs;
         this.ww.Context.Load(oWebs);
         this.ww.Context.ExecuteQuery();
         foreach (Web sww in oWebs)
         {
             Console.WriteLine("Site: {0}", sww.Title);
             Console.ReadLine();
             FunnelbackXmlSite fbxs = new FunnelbackXmlSite();
             fbxs.myfbx = this.myfbx;
             fbxs.ww = sww;
             fbxs.Process();
         }
     }
 }