Sql To Caml Query Convert To Mp3
With Microsoft Office SharePoint Server (MOSS) 2007 and Windows SharePoint Services (WSS) 3.0, we can use the Content Query Web Part (CQW or CQWP) to display SharePoint content from another source on a SharePoint page. This web part is rather nifty and one of my new favorite things about MOSS 2007. At first glance you tend to pass it by, then when you see what it can do, it is pretty cool. Grundig Sonoclock 410 Manualidades. Imagine if you will, creating a list in SharePoint 2003 and then adding it as a web part to your WSS home page or SPS portal area. You are then limited to controlling the view through the Web Part Tool Pane by hiding or showing various columns.
With the CQWP, you can now control how that content is displayed. You can wrap HTML code and styles to format the display nearly however you wish. Here is a quick example of a CQWP used on the ShareSquared.com site: The data that is used here is stored in a Pages library for a News site, which of course is just a list. Through Item Styles used by the CQWP, I can control the display of the data nearly any way I wish. Creating the Custom Item Style First, hands down this is a fantastic blog post to read on the subject: on the.
That post is what I followed to create custom Item Styles. This article is just to help fill in the blanks on how to use this process for your own site. I am going to breeze through some of the steps that are documented on the ECM blog, and go into others in more detail that are not documented in that post.
Add a CQWP To The Site • Add a Content Query Web Part to a page in the site. By default the CQWP will display all of the pages in the site. • Now choose to Modify the Shared Web Part and in the Web Part Tool Pane, expand Query and change the Source settings to the site or list where you want to query the data from. • Optionally update other settings to further refine the data view, such as Content Type and Filters.
I recently had a project where I needed to create a CAML query for a. Creating a Dynamic CAML Query. So if I were querying a SQL table I could do.
Select Apply. • For more details, look and Steps 1 and 2 in the post. Create the Custom Item Style Now we have a rather boring view of some data. We use Item Styles to jazz up the formatting and selectively show various content, such as Title, Description and Body. There are already several Item Styles available out-of-the-box, but in my opinion, they have limited use. Go ahead and play around with what is available, there maybe something there that is perfect for your needs and it helps you to see what you can do with an Item Style.
In the Tool Pane, expand Presentation and experiment with the drop down options under Styles. Select Apply to see the changes. Before we style any content, we need to have the web part pull in the content we want to display. Some content is already pulled in by default, such as Title. For anything else that is not pulled by default, we need to tell the web part to get those fields.
But how do we know which fields are already being pulled in? It is a bit of a chicken and the egg ordeal, so here are my suggested steps for working all of this information out: Heads up! Here is where we deviate from the post. • Open the site in SharePoint Designer (SPD). Navigate to Style Library, then XSL Style Sheets. Open ITEMSTYLE.XSL.
Now doing this will customize (uhghost) the file! But we can always reset this back to the Site Definition and restore it to it’s original state.
Be sure to check out the file via SPD or the Site Content and Structure screen in the site. • Take a minute to look at the file. Every time you see “ • Next we will add a little snippet of code within the Template tags that will render the names of the fields that are being passed. Note that this code will be temporary! We don’t want to leave this in the finished Item Style. P: • Save the file.
Return to the site (in the browser) and refresh the page. Open the Web Part Tool Pane for the CQWP and expand Presentation, then under Styles change the Item Style to the new custom style in the drop down. Select Apply. • The CQWP will now list out all of the fields that are being passed. After each P: is the internal column name for each field that is being passed. These internal column names are what is referenced later in the code to display the data.
For example: Description is the internal column name that is being wrapped and styled with a DIV tag and is the content that will display on the page. So we can look at the names displayed in the CQWP and see what data is already available for our use. For example, in this particular case we have Title, Author, Publishing Rollup Image and Publishing Date (PubDate).
Find the Additional Data Our first goal was to determine what content is already being pulled into the web part. Now that we have done that, next we need to tell the web part to pull the other data we need. To do this we will need to get the internal column names for the necessary column(s) from the Content Type that is being used for the list.
• In the site, open Site Settings, then select Site Content Types. Locate the Content Type that the list is using. For example: • If you are querying a site and showing pages, look under Page Layout Content Types. • If you are querying a list, look under List Content Types. • Select the Content Type name to view the Columns. Locate the column that needs to display in the custom item style.
Locate the internal column name one of two ways: • Way One: Click the column name. In the Change Site Content Type Column screen, hover over the Edit site column in new window link and note the URL that appears in the Status Bar. The internal column name appears after Field=. It also appears on the Site Content Type screen we just came from in the Status Bar, it is just inline with a lot of other characters. Often the string is too long in the Status Bar to display the Field property. • Way Two: Right click the link and select Properties. The URL listed in the General tab has the info we need, just hidden below the viewable area.
Select the URL with your cursor, hit Ctrl + A to select the full URL, the copy and paste the URL into Notepad. In the pasted URL in Notepad, locate Field=. The name that follows in the internal column name.
Now that we have our internal column name, we can return to the instructions in the post and proceed with their Step 3. Modify the CQWP to Include Additional Data • In your site, in the CQWP, select Export from the web part’s Edit menu. Save the.WEBPART file locally. • Open the.WEBPART file in Notepad and search for “ CommonViewFields“. Replace the Property tag line of code with the code listed below, using your internal column name and the corresponding field type. It is very important that the field type listed is the correct type for the the data. If the field type is wrong, it won’t break the site, but the Item Style won’t display the content.
Available values are: • Text • Note • Number • Currency • Integer • Boolean • DateTime • Threading • Lookup • Choice • URL • Counter • DisplayOnly (DisplayOnly field type has no storage of its own) And I have either used or seen these used, but have not seen them documented anywhere: • RichHTML • Image Some field types are easy to figure out. If we are calling a date, use DateTime. For Title use Text, for body content use RichHTML. String together multiple entries with a semicolon between each pair: Name, RichHTML; Name2, Text.
InternalColumnNameGoesHere, FieldType For example: Comments, Note At the end of this article I cover how to. • Save the file and import it back into the site.
( Add a Web Part – Import – select the.WEBPART file – Upload – Drag and drop the web part onto the page). Now we have two CQWPs on the page. We can remove the original one. We should also see the newly added internal column name(s) appear in the list of fields. 18 steps later and now we are ready to style!! No, really, this process moves pretty fast. Now it is time to return to the XSL file and start making things pretty.
Style the Data in the Item Style • Return to SharePoint Designer and your custom template in ITEMSTYLE.XSL. • For every internal column name that has been included in the web part and needs to display in the Item Style, add it to the template using the xsl:valuetag: For example: • Wrap HTML around the tag to format the data.
Please note!! When the page renders the CQWP, the site grabs the Item Style for each line of data. So we can’t add a table and expect that each line of data will be in a row.
Instead we get a full table for each line of data. Keep this in mind as you style the HTML around the data. • Save the file, go to the site and refresh the page.
The new styled content will appear. • To remove markup tags, please refer to about the middle of Step 4 in the post. • When done styling the Item Style, remove the code that lists the fields. P: The Other Internal Column Names & Finding Field Types If by some odd reason you were following along with this article and trying to do a CQWP Item Style on an events list, like I was, at the end of this you were probably scratching your head as to why no content would display on your site. While writing this article I discovered that the internal column name listed in the Content Type isn’t necessary the internal content name that should be used for Item Styles. I am sure I will make some developer have a heart attack with my terminology or what have you, but after a lot of searching I tracked down the real internal column names in the SCHEMA.XML file for each feature (every list type is a Feature).
Once I pulled the right internal column name in my.WEBPART file and in ITEMSTYLE.XSL, things worked like a charm. Consequently, SCHEMA.XML also lists out the field types for each column. • On the web server, open the SCHEMA.XML file for the Feature.
The Features are located in the Feature directory: Local Drive:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES(Feature Name) • Locate the SCHEMA.XML file. It will be in one of the two subdirectories in the Feature. Open the file in Notepad. • Locate the FIELDS element. Within Fields are all of the FIELD elements used in the Feature. Each one lists the column Type (field type) and Name (internal column name). • Use this column type and name in the.WEBPART file and in the ITEMSTYLE.XSL file.
To wrap up my commentary with the Events list, I changed “Comments” to “Description” and the CQWP successfully displayed the content in the CQWP. Custom Item Style Samples Here are some samples you can check out to see how it all comes together: Code: Screenshot: Code: Screenshot. Hii,I am developing an application in which i have created around 30 form libraries but for the end users i dont want to show these libraries.
I just want to show them all the documents present in those form libraries depending upon the item level permission.To achieve this i am implementing content query webpart and everything goes fine, but the problem is that i want to create UI of the content query webpart same as of my form library, i mean to say there should be colum headers with sorting and filtering functionality in the webpart for different fields present in the form library.I will appreciate any kind of comments or help on this problems.Thanks in advance.Prashant. Hello Heather-I have a question similar to Dirk’s question. I am attempting to connect a BDC List WP to a CQWP so that when I choose an item in my BDC List WP, it passes this to the CQWP which retrieves only those documents associated with that chosen BDC item – a reference to which is stored in a custom column in the document library I have my CQWP pointing to. I know this sort of connectivity already exists between a BDC List WP and the BDC Data Item and BDC Related List web parts, so I was thinking that it might already possible somehow by properly configuring the out-of-the-box web parts. Any thoughts you might have on this would be greatly appreciated. Thanks in advance.
I am trying to roll-up announcements from all sites in the collection. I am filtering only content type of “Public Announcement” and I can get it to work, but I am trying to get the announcements to start and stop at specific times and dates.
I am trying to use the QueryOverride with CAML. I have the fields set to date and time and I am using this CAML: I just can’t get this to work.
I have tried using the value, but it seems to ignore the time. Like I said, I want to schedule items to appear on the front page at specific times and dates.Any help would be appreciated!~Jeremy. I am encountering a problem with the ArticleStartDate property, and was wondering if you had any ideas.I’ve migrated all of the news postings of the past year from our previous CMS. I added in the Article Date field, and then populated it with the article release date (the date the news is to be made public).It works fine in the list, and I’m able to filter by it in the view. But when I pull this property out via the Content Query WP, the ArticleStartDate property seems to contain the date I posted the article itself?If I sort by it in the CQWP, they all contain the date I imported the item. This date appears when I print it to the page via the itemstyle.XSLAny thoughts? Maybe it’s pulling the XML property from the Publishing schema instead – which would give the item creation date?
I’m stumped.Should I just recreate the list as a non announcements content type – and add in the columns manually?Thanks! Forget my earlier link. It’s to a sharepoint 2003 utility Wont import to 2007.Check this out though. A sharepoint 2007 XML viewer!
One of the menus isn’t really obvious – so be sure to right click on the XML itself and you can save it to your computer – easier to search through it that way. I also figure out my problem I posted about earlier – someone else had posted to the list so I was mistaken.
Everything works beautifully!I was wondering if there was any way to add in the “Add new announcement” link at the bottom of the CQWP? I’m trying to edit the exported WP itself – but I’m just coming up errors. Hi Heather,I read your article on customizing the custom query web part. I have a unique question that I have spent time googling for quite some time now but haven’t found any thing discussing this.My question is when you set the height and width to pixels, this displays the horizontal and vertical scrollbars. The request I am trying to satisfy is getting the right vertical scrollbar to display by setting respective height property, however, regardless of what pixels you use to set the width, I cannot seem to hide the horizontal scrollbar. Basically, I am trying to create a scrollable article list with only the right scrollbar and not the horizontal scrollbar at bottom and haven’t been able to find a solution to resolve this.
Any insight you can provide would be appreciated.Jessie. Hi Heather,Just thought I’d throw this out there to see if you or anyone else has encountered this. I am able to following your instructions and get results pretty much as expected. The only problem I’ve had is when trying to filter by a custom field. I can get the field and its data to show up in the web part with no filters, but if I use the AdditionalFilterFields property to add the custom field to the drop-down, the results to do not return if I enter a value I know is there.Have you or anyone else experienced this?
I’ve put this on the MS Sharepoint Forum, but to no avail yet.TIA. Hi Heather, thank you very much for your great arcticles, they really save a lot of time!One thing that I’ve found out and think it is very important (just copy my own blog post with reference to your post):!!! Never use any spaces or even special characters when creating any fields in SharePoint!!!Maybe I’m not that good in it, but I haven’t found how to specify these field names as attribute names later in the XSLT transformations and wasted a lot of time. But then I checked how Microsoft handles fields like “Created by” and the like and – oh wonder – they named their fields “CreatedBy” and later changed the name to “Created By”. So the trick is to do the following:- Start to create new field (custom field in a list, site column etc.)- Choose a one-word name such as “PONumber” and save the new field- Open the field in edit mode again, change the name from “PONumber” to “Purchase Order Number” and save it again.The internal name used in the webpart definition file as well as in the ItemStyle.xsl is no “PONumber” and you don’t have to deal with complicated esacpings.Bye, Michael. Hi there,first of all thanks for the great post above – helped me a lot. I’m still a beginner when it comes to sharepoint customizing so I hope you can help me with these bunch of questions:)i created a template in the itemstyle.xsl to display the latest announcements.
I added the title, the date and the author to the output.So, my first question is (maybe the easier one): what has to be changed within the attached lines of code(or elsewhere) to display a 24h-format of the time? My second question is probably tougher: i wanted to display with the CQWP the latest documents of a scope. No problem bout that.The Problem comes up when I wanted to display the name! Of the document in the webpart – not the title. All i could find was the “FileRef”-Field, which displays the whole path of the document.I also discovered “FileleafRef” for the name of the document but couldn’t make it to display it in the webpart.Is there maybe a possibility with substring in combination of FileRef? Or how else can i display the name of the document?Finally, my last questions is what did i wrong in the following code? Why does my CQWP do not show the first 200 chars of the content of my announcements and just the “”?
Must be a stupid mistakes by myself but couldn’t find it! Modified by at O’Clock i also add the following lines in the.webpart-file:ExternalUrl,URL;PublishingPageImage,Image;PublishingPageContent,Note;I am appreciate for any hints.Thanks,Tim(Hope i english isn’t too bad). Hello Heather,Special thanks to you and to everyone to share this valuable informationI have a case and I do not know if it face any of you.When I use the CQWP to querylist all documents inside specific folder in specific Document Library, It does not work.The error is: “Cannot save the property settings for this Web Part. The list name is not valid. The list name should refer to a list within the specified site: /listname/”Any idea how I can modify the CQWP to list the content of a folder inside Document Library? Any help would be greatly appreciated. @James Posted @ 5/29/2007 5:04 PMHi Heather,Just thought I’d throw this out there to see if you or anyone else has encountered this.
I am able to following your instructions and get results pretty much as expected. The only problem I’ve had is when trying to filter by a custom field. I can get the field and its data to show up in the web part with no filters, but if I use the AdditionalFilterFields property to add the custom field to the drop-down, the results to do not return if I enter a value I know is there.Have you or anyone else experienced this?
I’ve put this on the MS Sharepoint Forum, but to no avail yet.————————————————————————–i had the same problem:i tried to filter a custom field, using this content query web part.i solved this problem creating a web part that gets my items using SPQuery and building a caml query. Overriding Render method i can display all my items, including those that comes from the custom field. I know that the Content Query Web Part comes with out of the box MOSS, but we have WSS 3.0 and need something that will do the same things that the CQWP will do. Is there any way to install this web part on WSS 3.0?
Alternately, do you know of any WSS 3.0 compatible web part that is able to do the same things as the CQWP. Specifically, we need to be able to merge 2 lists into one based on matching one column in one list with the same column in another (one list has employee paired with supervisor, the other employee with jobs, and we need a quick way to compile and keep updated supervisor with jobs with employee for email reminder purposes).