Sue Hernandez's SharePoint Blog

SharePoint and Related Stuff

Monthly Archives: July 2010

Readers can’t see reports in Report Center!

I had created a Report Center site, using MOSS Enterprise Version, and I put a few files in a Trusted Library.  As myself, with full rights, I could see the files, bring them up in Excel Services and EWA Web Parts.  I could even access them through the Excel Services Web Service, /_vti_bin/ExcelService.asmx (which was really what I was trying to do).

I gave a user Read permissions to the site, and Read permissions to the folder that the reports were in, as we had broken inheritance to the folder.  They couldn’t access my web part that was using the ExcelService web service, and come to find out, they couldn’t see any files when they browsed the library.

Turned out to be something really simple, but easy to overlook.  In the settings of the Report Center library, BY DEFAULT, it is marked such that ONLY users who can edit items can see “Draft” items.  But wait, there’s no content approval turned on!  Didn’t matter – versioning was enabled (again, by default), to hold both Major and Minor versions.

In order for the readers to see your reports, you have to click on the dropdown to the right of the document and choose “Publish Major Version”.  That was it.  Thought I’d share.

MOSS – Iterate through List using JQuery and Ajax

Here’s some script using  jquery to iterate through a list when you only know the name of the list and not the GUID.  That helps when you want to use the same script on multiple sites.  This can go in a content editor web part.  Replace the locations of the JQuery Library and your Site URL. 

<script type='text/javascript' src='https://YourSiteHere/YourLibraryHere/jquery-1.4.2.min.js'></script>
<div id="divReportOutput"></div>
<script language="javascript">
var s = "<table width='100%' cellpadding='5' cellspacing='0'>";
    var soapRequest = '<?xml version="1.0" encoding="utf-8"?>
                       <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                       <soap:Body><GetListCollection
                       xmlns="http://schemas.microsoft.com/sharepoint/soap/"></GetListCollection>
                       </soap:Body></soap:Envelope>';
    $.ajax({
        url: "https://YourSiteHere/YourSubSite/_vti_bin/Lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapRequest,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
}
function processResult(xData, status)
{
    var reportListGUID = "";
    var xDoc = xData.responseXML;
    try
    {
        var ID1 = xDoc.selectSingleNode("//List/@ID[../@Title='" + NameOfYourDocumentLibrary + "']");
        reportListGUID = ID1.value;
    }
    catch(ex) { reportListGUID = ""; }
    if(reportListGUID != "")
    {
        // With Query
        //var newSoapEnvelope = '<?xml version="1.0" encoding="utf-8"?>
                                 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                                 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
                                 <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                                 <listName>' + reportListGUID + '</listName>
                                 <query><Query><Where><Contains><FieldRef Name="FileLeafRef" />
                                 <Value Type="Text">' + YourDocumentName + '</Value></Contains>
                                 </Where></Query></query></GetListItems></soap:Body></soap:Envelope>';
        // Everything
        var newSoapEnvelope = '<?xml version="1.0" encoding="utf-8"?>
                               <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
                               <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                               <listName>' + reportListGUID + '</listName></GetListItems>
                               </soap:Body></soap:Envelope>';
        $.ajax({
            url: urlToQuery,
            type: "POST",
            dataType: "xml",
            data: newSoapEnvelope,
            complete: processListItemsResult,
            contentType: "text/xml; charset=\"utf-8\""
        });
    }
}
function processListItemsResult(xData, status)
{
    var xDoc = xData.responseXML;
    var matchingNodes = xDoc.selectNodes("//z:row");

    for(var i = 0; i < matchingNodes.length; i++)
    {
        var alternating = "";
        if(i % 2 == 1)
        {
            alternating = " class='ms-alternating'";
        }

        var uploadedOn = xDoc.selectSingleNode("@ows_Modified");
        var linkNode = xDoc.selectSingleNode("@ows_FileRef");
        var link = linkNode.value.substr(linkNode.value.indexOf("#") + 1);
        s += "<tr" + alternating + "><td class='ms-vb'><a href='" + link + "'>" + link + "</a></td>
              <td class='ms-vb'>Uploaded On: " + uploadedOn.value + "</td></tr>";
    }
    // Output the text
    s += "</table>";
    $('#divReportOutput').html(s);
}
</script>

MOSS 2007 Site Collection – What happened to everyone’s permissions?

I have just run in to a case where the Farm Administrator account and 2 site collection administrators were missing 1/2 of the links on the Site Actions menu – namely they couldn’t create, edit, or view Site Settings –> All Site Settings.  When you navigated to the Site Settings page manually, you couldn’t click on some of the links such as Navigation – you would get an Access Denied error.  And finally, you couldn’t modify Lists and Libraries, and you couldn’t add people to groups or remove them from groups.

After a bunch of searching on the internet to no avail, I came across one article that seemed to be for something else, that mentioned something about a site collection being “Read Only”.  So I searched for that and I found something that I tried, and lo and behold it worked!

What it was, is that an stsadm backup had failed the night before, by all accounts reading the Application event logs.  When the stsadm backup runs, it puts the site collection in “Read Only” mode.  If the backup catastrophically fails, it doesn’t get the chance to turn the site back to read-write.

So how did we fix it?  It was in Central Administration, under the Application Management tab, in the section called SharePoint Site Management.  It is the link “Site Collection quotas and locks”.  Click that link and change your site collection to the one in question.  Under the section “Site Lock Information” you have choices of “Not Locked”, “Adding Content Prevented”, “Read Only” and “No Access”.  Change it from “Read nly” to “Not Locked” and press OK.