SharePoint 2007 control/webpart to display field value from another page - sharepoint

In SharePoint 2007, how to display a value of a field from another page?
Similar to the below:
<SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
but it's from another SharePoint page.

SharePointWebControls:FieldValue displays values from the current SharePoint context, the current list item.
To display a value from another page, i suggest using the Content Query Web Part, to query the page you need.
http://msdn.microsoft.com/en-us/library/aa981241.aspx
Select the fields you want to display, the list you want to lookup, and item/page you want to select
<ViewFields>
<FieldRef Name="Title" Nullable="True" Type="Text"/>
</ViewFields>
<Lists>
<List ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"/>
</Lists>
<Webs Recursive="True" />
<RowLimit>1</RowLimit>
<Where>
<Gt>
<FieldRef Name="Created" Nullable="True" Type="DateTime"/>
<Value Type="DateTime"><Today OffsetDays="-7"/></Value>
</Gt>
</Where>

Related

Data Driven SSRS Subscription using the XML-Based Query Language for SharePoint List Connections

I have an SSRS report that uses the SharePoint List data connection. It works just fine using the query below. I want a Data Driven Subscription to email the report to the user whose email address shows in the report. The problem is that a user can show up multiple times in the same run of the report and SSRS seems to want to send them an email for each time their email address shows up. I used to do this all the time with reports that used standard t-SQL using Select Distinct but this xml based query language doesnt seem to have such a function.
Does anyone have any ideas about how to either get SSRS to be smart enough to send only one email per person OR get a variation on this query to only return each email address once?
Thanks
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>SSRS_Subscriptions</ListName>
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="count" />
<FieldRef Name="eMail" />
<FieldRef Name="Org" />
</ViewFields>
<Query>
<Where>
<Gt>
<FieldRef Name="count" />
<Value Type="Number">0</Value>
</Gt>
</Where>
</Query>
</RSSharePointList>

SSRS Recurrence Items from Calender List Sharepoint - The SharePoint list query is not valid: The XML element QueryOptions in the query is not valid

I am trying to grab all items in the next upcoming week from a sharepoint list, some of these may be recurring items that have been created a few months back. I am getting the below error:
The SharePoint list query is not valid: The XML element QueryOptions in the query is not valid.
This is my sharepoint query designer code in SSRS:
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>Change Control</ListName>
<Query>
<Where>
<DateRangesOverlap>
<FieldRef Name='EventDate' />
<FieldRef Name='EndDate' />
<FieldRef Name='RecurrenceID' />
</DateRangesOverlap>
</Where>
</Query>
<QueryOptions>
<ExpandRecurrence>TRUE</ExpandRecurrence>
<ViewAttributes Scope='RecursiveAll' />
</QueryOptions>
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="Originators_x0020_Name" />
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="ID" />
<FieldRef Name="RecurrenceID" />
<FieldRef Name="RecurrenceData" />
<FieldRef Name="Staff_x0020_Involved_x0020_with_" />
</ViewFields>
</RSSharePointList>
What you've posted is indeed a valid CAML query but it's clear the SharePoint List Query in SSRS does not support the full range of CAML (reference).
Instead you should setup an "XML Data Source" inside SSRS and hook that up to a SharePoint web service that does support the full range of CAML queries.
Summary of steps:
Open report builder
Right click the “Data Sources” folder and select “Add Data Source”
Enter “XMLTest” as the data source name
Select “Use a connection embedded in my report”
Select “XML” as the “Connection Type”
For the connection string you’ll want to enter the URL to your site plus “/_vti_bin/lists.asmx”. (You can verify the connection string by entering it into your web browser. Doing so should return a list of web services for the site.)
Click on the “Credentials” menu item on the left hand side of the “Data Source Properties” window
Select the option “Use the current Windows user. Kerberos delegation might be required.”
Click the “OK” button on the “Data Source Properties” window.
Source: http://tavislovell.com/using-ssrs-with-sharepoint-library-folders/

how to get double records in SharePoint CAML query?

I've created a View and did group by on a field and then did count on that field. It gives me all records and the total counts. I want to show only records which are greater than 1.... where to put this Greater than in the code ?
I created the view and I opened the view in SharePoint designer and my code looks like this now? I want to put somewhere count(Commitment_x0020_Reference) > 1
<XmlDefinition>
<View Name="{358474DF-DB87-423E-A795-6C361A33655F}" MobileView="TRUE" Type="HTML" DisplayName="Double SI" Url="/networks/SCP/Lists/Contracts and Studies/Double SI.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/generic.png?rev=23" >
<Query>
<GroupBy Collapse="TRUE" GroupLimit="500">
<FieldRef Name="Commitment_x0020_Reference"/>
</GroupBy>
<OrderBy>
<FieldRef Name="Date_x0020_of_x0020_Reception" Ascending="FALSE"/>
<FieldRef Name="Modified" Ascending="FALSE"/>
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="ID"/>
<FieldRef Name="Edit"/>
<FieldRef Name="Type_x0020_of_x0020_Procedures"/>
<FieldRef Name="Unit"/><FieldRef Name="Reference"/><FieldRef Name="Title1"/><FieldRef Name="_x0039_i_x002d_Com_x0020_L2_x002"/><FieldRef Name="Modified"/><FieldRef Name="Editor"/><FieldRef Name="_UIVersionString"/>
</ViewFields>
<RowLimit Paged="TRUE">50</RowLimit>
<Aggregations Value="On">
<FieldRef Name="Commitment_x0020_Reference" Type="COUNT"/>
</Aggregations>
<JSLink>clienttemplates.js</JSLink>
<XslLink Default="TRUE">main.xsl</XslLink>
<Toolbar Type="Standard"/>
</View>
The short answer is that you can't. Querying by the sum of grouped results is not possible with a single CAML query.
Alternate options would be to perform post-processing on the results, so the query returns all records, then you remove the unwanted records on the client side, such as with JavaScript; or you could perform multiple queries in sequence to retrieve every possible value for Commitment_x0020_Reference, then perform multiple queries using those values to retrieve and count the number of results for each Commitment_x0020_Reference value.
Neither of those options is very straightforward to implement from the SharePoint Designer GUI, and may warrant a separate Stack Overflow question depending on your approach.

How to filter the view in Sharepoint, basing on user selected in Infopath form?

I have a Infopath form, published to Sharepoint 2013, in which user selects exactly one person, using a people picker. Outside of form I have columns DisplayName and AccountID. I want user, who is viewing a list, to see only objects which are either modified by him, created by him, or if he was selected in form.
Trying to limit the view from browser-based view creator is most probably impossible, as neither of columns available outside are of type User. I then moved to Sharepoint Designer 2013, and dived into CAML. This did not help either.
How can I check, if currently logged user is the same user, as the one selected in form? I tried using CAML, but to no effect(last FieldRef is reference to column, in this example AccountID).
<Where>
<Or>
<Or>
<Eq>
<FieldRef Name="Editor"/>
<Value Type="Integer">
<UserID Type="Integer"/>
</Value>
</Eq>
<Eq>
<FieldRef Name="Author"/>
<Value Type="Integer">
<UserID Type="Integer"/>
</Value>
</Eq>
</Or>
<Eq>
<FieldRef Name="_638fe3aa_9161_4aa5_8bd1_862678d9fc06"/>
<Value Type="Integer">
<UserID Type="Integer"/>
</Value>
</Eq>
</Or>
</Where>
If this can be achieved from code in Infopath, or in any other way, the answer will be as well accepted - I do not want exactly CAML based answer, I want any workable answer to my problem :)
A simple filter in the view for each of the columns you would like to filter on set to [Me] should show logged in users only people picker values that are equal to themselves.
If the field in the form is a people picker then you must be storing the user data in a column somewhere unless you are discarding the data after processing it using a rule to update other fields. If that is the case, I don't see why you can't keep the people picker data stored in a column that you don't display in the view. You do not have to base the filter off of a field you are actively displaying for it to work and you are already using the right type of control to get the data you need.
Created By and Modified By columns are always user values.

CAML Query

I'd like to have a CAML query to get the events from a calendar list.
I want to get all the events including Today in the upcoming 30 or so days.
So far I have:
<Where>
<DateRangesOverlap>
<Geq>
<FieldRef Name=\"EventDate\" />
<Value Type=\"DateTime\">
<Today />
</Value>
</Geq>
<FieldRef Name=\"EndDate\" />
<FieldRef Name=\"RecurrenceID\" />
<Value Type=\"DateTime\">
<Month />
</Value>
</DateRangesOverlap>
</Where>
This does not work :( Any ideas?
As Nat has said you hint (but don't specify) that you are using recurring events in your calendar list so I am assuming that is the part that's not working?
You need to set the SPQuery.ExpandRecurrances and SPQuery.CalendarDate property prior to running the CAML query and you can only do this using the object model, not the web services or by setting an attribute in CAML.
Further - IIRC this will only expand out instances of recurring events that occur in the same calendar month as .CalendarDate so you have to run it multiple times to get a multi-month view.
This is by far the best reference covering recurring events I have found.
Understanding the SharePoint Calendar and how to export it to iCal format
Welcome to the nightmare of recurring events in SharePoint!
The recurrence does not actually add all the events into the list, but the CAML can only query from "actual" events stored in the list.

Resources