One of my customers had an issue, the Content and Structure reports were not working.
Marc had a similar issue, so I tested his Command Line App and found the same issue:
Then I used sitecollectionreportslist.exe to set this GUID - and VOILA now the reports are working again!
Hmm, I was a bit too fast here - seems this didn't do the trick anyway...
So, the property is named _VarRelationshipsListId, and I used this in my code to get and set this value.
1: using System;
2: using System.Collections.Generic;
3: using System.Text;
4: using Microsoft.SharePoint.Publishing;
5: using Microsoft.SharePoint;
6:
7: namespace VariationRelationshipsList
8: { 9: class Program
10: { 11: private const string KEY_VariationRelationshipsList = "_VarRelationshipsListId";
12: private const string PARAM_VariationRelationshipsListId = "-setVariationRelationshipsListId";
13: private const string PARAM_Help = "-help";
14: private const string PARAM_Url = "-url";
15:
16: static void Main(string[] args)
17: { 18: List<string> lstArgs = new List<string>(args);
19: if (lstArgs.Contains(PARAM_Help) || lstArgs.Count == 0)
20: { 21: PrintHelp();
22: return;
23: }
24: if (lstArgs.Contains(PARAM_Url))
25: { 26: int indUrlFlag = lstArgs.IndexOf(PARAM_Url);
27: if (lstArgs.Count > indUrlFlag + 1)
28: { 29: string siteUrl = lstArgs[indUrlFlag + 1];
30: try
31: { 32: using (SPSite site = new SPSite(siteUrl))
33: { 34: if (!PublishingSite.IsPublishingSite(site))
35: { 36: Console.WriteLine("Site must be a publishing site"); 37: return;
38: }
39: PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(site.RootWeb);
40: GetVariationRelationshipsListInformation(pWeb);
41:
42: if (lstArgs.Contains(PARAM_VariationRelationshipsListId))
43: { 44: SetVariationRelationshipsList(lstArgs, pWeb);
45: }
46: }
47: }
48: catch (Exception ex)
49: { 50: Console.WriteLine(ex.ToString());
51: }
52: }
53: }
54: }
55: private static void GetVariationRelationshipsListInformation(PublishingWeb pWeb)
56: { 57: if (pWeb.Web.AllProperties.ContainsKey(KEY_VariationRelationshipsList))
58: { 59: string result = pWeb.Web.AllProperties[KEY_VariationRelationshipsList].ToString();
60: Console.WriteLine(string.Format("Reports List ID: {0}", result)); 61:
62: Guid listID = new Guid(result);
63: SPList reportsList = null;
64: try
65: { 66: reportsList = pWeb.Web.Lists.GetList(listID, false);
67: }
68: catch (Exception) { } 69: if (reportsList == null)
70: { 71: Console.WriteLine("Variations Relationships list could not be found at given GUID"); 72: }
73: else
74: { 75: Console.WriteLine("Variations Relationships list was found at given GUID"); 76: }
77: }
78: else
79: { 80: Console.WriteLine(KEY_VariationRelationshipsList + " property was not set on the current site");
81: }
82: }
83: private static void SetVariationRelationshipsList(List<string> lstArgs, PublishingWeb pWeb)
84: { 85: int indSetReportListIdFlag = lstArgs.IndexOf(PARAM_VariationRelationshipsListId);
86: if (lstArgs.Count > indSetReportListIdFlag + 1)
87: { 88: string newVariationsRelationshipsListId = lstArgs[indSetReportListIdFlag + 1];
89: //check to make sure this list actually exists
90: SPList newList;
91: try
92: { 93: newList = pWeb.Web.Lists.GetList(new Guid(newVariationsRelationshipsListId), false);
94: }
95: catch (Exception)
96: { 97: Console.WriteLine(string.Format("Could not find new list: {0}", newVariationsRelationshipsListId)); ; 98: return;
99: }
100: Console.WriteLine(string.Format("Setting new variations realtionships list id: {0}...", newVariationsRelationshipsListId)); 101: if (!pWeb.Web.AllProperties.ContainsKey(KEY_VariationRelationshipsList))
102: pWeb.Web.AllProperties.Add(KEY_VariationRelationshipsList, newVariationsRelationshipsListId);
103: else
104: pWeb.Web.AllProperties[KEY_VariationRelationshipsList] = newVariationsRelationshipsListId;
105: pWeb.Web.Update();
106: }
107: }
108:
109: private static void PrintHelp()
110: { 111: Console.WriteLine(string.Format("{0} <http://.... the url of the site collection to target>", PARAM_Url)); 112: Console.WriteLine(String.Format("[{0}] <the guid of the list to which the Reports List property for the site should be set>", PARAM_VariationRelationshipsListId)); 113: }
114: }
115: }
And, after running this handy little app - Content and Structure (SiteManager) is back online!