.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Content Query Web Part (CQWP) fails to show picture items from a document/picture library in an anon

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :SharePoint
I have a Picture Library and am trying to use the CQWP to display a list of items in the library.  The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users. The error log message is: Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) I'm running SP 2010.  I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Us

View Complete Post

More Related Resource Links

Content Query Web Part - Filter Contents of Document Library



I would like to display selective content of document library using content query web part. My document library has multiple folders. I would like to have the content query web part display the contents of one particular folder. And also another content query should display the contents based on a column in the document library. I don't see these options when customizing the query for the content query web part. If this is not possible by default, what is the potentail alternative solution ?



Srikanth Reddy

how to merge contents of a form library and picture library into a report (word or pdf) document

Hi all           I want to generate a report  containing data from a form library and pictures from a picture library. I am able to generate ms word report from data filled in form library using http://www.bizsupportonline.net/infopath2007/convert-infopath-form-into-word-2007-document-xslt-c-sharp.htm . . But now actually i need to merge images from a picture library into that word  document . thnxs 

Picture Library Slideshow Web Part

I have a picture library in a subsite, and I want to set Slideshow with these pictures on main site page. When I try to edit Slideshow web part, there is no picture libraries in it.

Do I have to put picture library in main site to be able to put slideshow on main page?

Issue with Picture Library Slideshow Web Part after export/import of site collection (SP2010)


I recently exported/imported an SP2010 site collection from Dev to Prod. The site collection had about 90 sites, which were all driven from a site template. Once the export/import had taken place, I created an additional 15 sites (in Prod), using the original site template that was created in the Dev environment. Everything seemed to be working just fine, but I found an issue with the Picture Library Slideshow Web Parts (PLSWP) on all the sites that were created in Prod. Basically, I have a Picture Library, and any pictures added to this library show up in the PLSWP. The original 80 site's PLSWP works fine, but the new 15 sites will not show the pictures through the PLSWP (the viewer just shows up blank). Here is the difference in the html output of the picture viewer:

 PLSWP from Dev:

 <a target="_blank" href="http://forefronttest/realestate/RE/West/HOU/3560/Project%20Pictures/test.jpg" id="MSOPictureLibrarySlideshowWebPart_ctl00_m_g_28b22a62_6d8

query to get Items from sub folders in a document library




i am having a document library  MY LIBRARY with SUB Folders SUB 1, SUB 2,SUB 3 ,SUB 4


i need to retreive documents in SUB 1, SUB 2 only

How can i write CAML query for this?

If need to retreive from one sub folder, i am using


qry.Folder = list.ParentWeb.GetFolder("MY LIBRARY /SUB 1");


Thanks and Regards,




Document Library View - "Folders or Flat --> Show all items without folders" setting not being saved


A view of a document library has a setting under Folders area if the files should be shown in their respective folder or just a flat list of file. If "Show all items withtout folders" is selected, following is my observation:

- Saving the document library as a template and creating new libraries from this template takes this setting into the new library as expected
- Saving the site as a template and creating a new site from template removes this setting from the existing document libraries in newly created sites. If a new document library is created from the document library template, the setting is ON as expected.

This seems to be related to what being discussed here http://stackoverflow.com/questions/3574095/hiding-folder-structure-for-a-view-in-sharepoint-2010-list-definition and http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/05e46fc9-cb26-4d00-aaf0-e4b6ee944104

Any feedback?

How to view pictures in folders using Picture Library Slideshow Viewer Web Part

I have a picture library with folders in it. When I use the Picture Library Slideshow Viewer Web Part, it does not show pictures that are in folders. Is there a way around this? I would really like to have just a couple folders with about 10 pictures in each that I can view. Any ideas?

Adding New Custom Folder Content Type doesn't show up on the Document Library New Menu


I been trying to add new custom folder content type to the document library programatically in my sandbox environment and it does show up on the document library. But, when I move same code to the almost similar configured SP2010 environment, adding new folder content type to the document library doesn't show up on the document library's new menu.

Here is the code? Since this code works fine in my sandbox environment, is there any other settings I should check on the server environment which would cause hiding content type on new menu of document library.

  class Program
    static void Main(string[] args)
      SPSite spSite = new SPSite("http://sp2010vm");
      foreach (SPWeb spWeb in spSite.AllWebs)
        spWeb.AllowUnsafeUpdates = true;

        //For each site, cycle through lists
        bool isDocLibraryExists = false;
	      foreach(SPList spList in spWeb.Lists)
          if(spList.Title == "Classified Documents")
             isDocLibraryExists = true; 
        if(isDocLibraryExists == true)
          //Create new doc library
          SPList splist = spWeb.Lists["Classified Documents"];

          //Create Content Type
          SPContentType documentContentType = spWeb.AvailableContentTypes["Classified Documents Folder"

Picture Library slide show setting


Is there any way to change the settings of a picture library slide show? My clients would like to see some of the attributes of the pictures in the slide show.


Content Query web part - how to open documents on first click instead of first opening the document


Hi all, Hopefully this is a easy settings change question, when I create a content query web part and have it look at documents in a document library (Either document library or document centre) when I click on the name of the document (link to doc) in the content query it opens up a page that list the document properties, I then have to click on the "Name" of the document link to open the document but when i close the document I end up at the library that the document is in and not on the page that I clicked on  the link in content query web part. So in some cases a user is on a site and clisks on a link(in a content query web part) that eventaully opens a document in the document centre and when they close the doucment there end up in the document centre.

Any ideas why this behaviour is suddendly happening, it didn't happen when I first added the content wuery web parts, thanks in advance.


Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

Content Query Web Part missing in SharePoint 2010

If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

GridView does not show picture in row


OK, what is the problem here?

I do a gridview code that when displaying the information that come from the database is not showing any error at all, but is not displaying the right picture.

The problem,  I think, is that the (Eval("....") is not reading the values that are coming from the DataKeysNames. Due to this the right pictures are not displayed. But in another column, just for testing purposes I was able to display the values from DataKeysNames with the Eval. So I do not know what is going on and to make worse browser is not giving me any error.

So, this is the line that is not processing, reading or executing well:

ImageUrl='<%# IIF( (Eval("TUDTIWasItemUpgraded")) = "Yes",           string.Format("~/Images/ItemUpgradedTo.gif"),          string.Format("~/Images/ItemNoUpgradedYet.gif")    )       %>'     


And this is the complete code for the GridView



Issue With MOSS 2007 Picture library



We have a MOSS 2007 publishing portal. We are currently facing issues with Picture library created with default picture library template.Whenever we have tried to upload an image to the picture library I am getting "acess denied" error message, though I have full permission to the site level as well as to the library level.I have seen the pictures are getting uploaded and in "checked out" state.It does not show the "edit properties" page on upload and does not even allow the owner of the image to edit the properties, gives the same access denied error message.

I have also tried to check in the image files through the "management and content structure", but the images are not getting checked in. Please let me know the root cause of this and how we can resolve this.





Customizing the Content Query Web Part in SharePoint Server 2007

Walk through how to customize the Content Query Web Part in SharePoint Server 2007 to query content across multiple sites in a site collection and display the results in any way that XSL can support. Learn how to get similar results when customizing the CQWP does not meet your needs.

Display the content of a Word document in a web part?

Hello all,We are planning to display the content of the word document pulling document from document library in a web page in sharepoint as a web part.So, based on above requirement , I have to display word document in a container/control which allows word document to edit, read and save it back to document library.I know that if you have Office 2007 installed we can convert the word document to web page and display it in the page viewer web part but we have office 2003 suite. So we are looking for web part which can display the content of the word document inline with the web page.Thanks in advacne,Chakri

Cannot add SQL Server 2008 R2 Report items to SharePoint Server 2010 document library

Using account which is the primary parent site administrator, can upload RDS and RDL files to the document library (however, cannot open report). User is also a domain admin with SA on the database instances. Cannot add Report Data Source with "New Document" icon. The permissions granted to user '[domain]\[user]' are insufficient for performing this operation. Under "Site Settings", "Managed Shared Schedules" fails with same error. Attempting to deploy from BIDS results in the same permissions error. Sharepoint Server 2010, Report Server 2008 R2. RS and SP databases hosted on remote server (SQL Server 2008 R2). All connections (SharePoint services, RS services, users) except SQLAgent authenticating to remote SQL Server with Kerberos (all SPNs look correct). Single site, site collection "/". Document directory called "Reports". Windows Integrated Security (Negotiate). How would I troubleshoot/solve problem?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend