2

I have a publishing site in 2013, pretty much OOTB. It has a news section as well which is where I created a bunch of news articles and everything is published.

I then went to create a CQWP on the Home Page of the Site Collection. I added the CQWP, left it at its defaults and have Pictures and Images.

Then I exported the part to get the .webpart and changed it to point at custom item and main xsl files in the style library.

I altered the Main to output all XML so I can add my custom fields and see what they look like. This is the bit of xml that does it

      <xsl:template match="/">
        <xmp><xsl:copy-of select="*" /></xmp>
      </xsl:template> 

It returns this

 <dsQueryResponse>
        <Rows>
          <Row ListId="FBE9959B-E067-4641-A723-B97BAF4C9330" WebId="0DB3F73A-F288-4BA6-BB88-0BFA34A1A13C" ID="22" _x007B_fa564e0f_x002D_0c70_x002D_4ab9_x002D_b863_x002D_0177e6ddd247_x007D_="Video Test Article" _x007B_94f89715_x002D_e097_x002D_4e8b_x002D_ba79_x002D_ea02aa8b7adb_x007D_="News/Pages/Video-Test-Article.aspx" _x007B_1d22ea11_x002D_1e32_x002D_424e_x002D_89ab_x002D_9fedbadb6ce1_x007D_="22" _x007B_28cf69c5_x002D_fa48_x002D_462a_x002D_b5cd_x002D_27b6f9d2bd5f_x007D_="2015-01-20 15:04:24" _x007B_1df5e554_x002D_ec7e_x002D_46a6_x002D_901d_x002D_d85a3881cb18_x007D_="Danny" _x007B_d31655d1_x002D_1d5b_x002D_4511_x002D_95a1_x002D_7a09e9b75bf2_x007D_="Simon" _x007B_8c06beca_x002D_0777_x002D_48f7_x002D_91c7_x002D_6da68bc07b69_x007D_="2015-01-19 14:21:29" _x007B_30bb605f_x002D_5bae_x002D_48fe_x002D_b4e3_x002D_1f81d9772af9_x007D_="0" _x007B_ba3c27ee_x002D_4791_x002D_4867_x002D_8821_x002D_ff99000bac98_x007D_="0x400000300c231061" _x007B_c5c4b81c_x002D_f1d9_x002D_4b43_x002D_a6a2_x002D_090df32ebb68_x007D_="" _x007B_8fca95c0_x002D_9b7d_x002D_456f_x002D_8dae_x002D_b41ee2728b85_x007D_="4493" _x007B_39360f11_x002D_34cf_x002D_4356_x002D_9945_x002D_25c44e68dade_x007D_="aspx" _x007B_543bc2cf_x002D_1f30_x002D_488e_x002D_8f25_x002D_6fe3b689d9ac_x007D_="&lt;img alt=&quot;&quot; src=&quot;/News/PublishingImages/Pictures_Rosie%20smalljpg.jpg?RenditionID=2&quot; style=&quot;BORDER&amp;#58;0px solid;&quot; /&gt;" _x007B_43bdd51b_x002D_3c5b_x002D_4e78_x002D_90a8_x002D_fb2087f71e70_x007D_="1" _x007B_9da97a8a_x002D_1da5_x002D_4a77_x002D_98d3_x002D_4bc10456e700_x007D_="" _x007B_b9e6f3ae_x002D_5632_x002D_4b13_x002D_b636_x002D_9d1a2bd67120_x007D_="" _x007B_691b9a4b_x002D_512e_x002D_4341_x002D_b3f1_x002D_68914130d5b2_x007D_="" PubDate="Tue, 20 Jan 2015 15:04:24 GMT" FileExtension="aspx" FileSize="4493" DocumentIconImageUrl="/_layouts/15/IMAGES/ichtm.gif" ImageUrl="/News/PublishingImages/Pictures_Rosie%20smalljpg.jpg?RenditionID=2" ImageUrlAltText="" Title="Video Test Article" LinkUrl="http://sp2013.ecm.development.int/News/Pages/Video-Test-Article.aspx" Style="Default" GroupStyle="DefaultHeader" __begincolumn="True" __begingroup="False" />
        </Rows>
      </dsQueryResponse>

I deleted the webpart off the page and then went to add a new site column. I did this at the SPSite level, called it "TeaserHome" *note no space no special chars, its a text field.

I then added this Site Column to the "Article Page" Content Type, which all my articles are based on.

I then went and set some of these values in the articles so there is some data.

I edited my .webpart and added

<property name="CommonViewFields" type="string" >TeaserHome, Text;</property>

Then I Imported the .webpart on the homepage again, and there in the XML was the TeaserHome attribute on one of the rows.

<Row TeaserHome="This is teaser home text" />

GREAT.

Saved the page, publish etc.

Then I re-edited the page, deleted the .webpart.

I then re-imported the webpart and re-added it.

Now the XML does not contain the attribute TeaserText, it changed to to an encoded Guid.

<Row _x007B_e605c9b0_x002D_b7a3_x002D_4d3a_x002D_884c_x002D_4879742a0c47_x007D_="This is teaser home text" />

**I cut out most the attribs this time but you get the idea.*

Every subsequent import and re-add now has a GUID for a field name, which is no good, it should be its Internal Name. Adding a DataColumnRename makes no difference.

The Column did not change I can go and query the list, site columns etc, I never touched it or renamed it or nothing.

I repeated these steps and it happened again, with a brand new site column first time round it works, delete and re-add the part and the field names some stupid encoded guid, which then of course I can't reference in my XSLT (maybe I could try and reference the Guid but that would be a stupid thing to do, the name should work).

I have to be able to delete and add web parts without worrying about some key functionality breaking.

Does anyone have a solution to this.

1 Answer 1

0

I've had the same issues as you're describing. There is no fix for this without customization. The best way to go is to write your own SharePoint Hosted App Part that does the same as the CQWP does.

Within the browser there is no solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.