I am attempting to update a list item using the SharePoint REST API but am encountering the following error:
<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.SharePoint.Client.InvalidClientQueryException</m:code>
<m:message xml:lang="en-US">The expression "web/lists/GetByTitle('Drop Off Library')/items("http:/example.com/_api/Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')")" is not valid.</m:message>
</m:error>
After adding the file, I receive the following response:
<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://example.com/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>http://example.com/_api/Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')</id>
<category term="SP.File" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Author" type="application/atom+xml;type=entry" title="Author" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Author" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CheckedOutByUser" type="application/atom+xml;type=entry" title="CheckedOutByUser" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/CheckedOutByUser" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/EffectiveInformationRightsManagementSettings" type="application/atom+xml;type=entry" title="EffectiveInformationRightsManagementSettings" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/EffectiveInformationRightsManagementSettings" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/InformationRightsManagementSettings" type="application/atom+xml;type=entry" title="InformationRightsManagementSettings" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/InformationRightsManagementSettings" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/ListItemAllFields" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LockedByUser" type="application/atom+xml;type=entry" title="LockedByUser" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/LockedByUser" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" type="application/atom+xml;type=entry" title="ModifiedBy" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/ModifiedBy" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Properties" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Versions" type="application/atom+xml;type=feed" title="Versions" href="Web/GetFileByServerRelativeUrl('/DropOffLibrary/b.txt')/Versions" />
<title />
<updated>2019-01-11T14:47:13Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:CheckInComment></d:CheckInComment>
<d:CheckOutType m:type="Edm.Int32">0</d:CheckOutType>
<d:ContentTag>{2BDD4E2D-79C8-4F6B-8DD7-AC745D9360A8},1,1</d:ContentTag>
<d:CustomizedPageStatus m:type="Edm.Int32">0</d:CustomizedPageStatus>
<d:ETag>"{2BDD4E2D-79C8-4F6B-8DD7-AC745D9360A8},1"</d:ETag>
<d:Exists m:type="Edm.Boolean">true</d:Exists>
<d:IrmEnabled m:type="Edm.Boolean">false</d:IrmEnabled>
<d:Length m:type="Edm.Int64">4</d:Length>
<d:Level m:type="Edm.Byte">255</d:Level>
<d:LinkingUrl></d:LinkingUrl>
<d:MajorVersion m:type="Edm.Int32">1</d:MajorVersion>
<d:MinorVersion m:type="Edm.Int32">0</d:MinorVersion>
<d:Name>b.txt</d:Name>
<d:ServerRelativeUrl>/DropOffLibrary/b.txt</d:ServerRelativeUrl>
<d:TimeCreated m:type="Edm.DateTime">2019-01-11T14:47:13Z</d:TimeCreated>
<d:TimeLastModified m:type="Edm.DateTime">2019-01-11T14:47:13Z</d:TimeLastModified>
<d:Title m:null="true" />
<d:UIVersion m:type="Edm.Int32">512</d:UIVersion>
<d:UIVersionLabel>1.0</d:UIVersionLabel>
<d:UniqueId m:type="Edm.Guid">2bdd4e2d-79c8-4f6b-8dd7-ac745d9360a8</d:UniqueId>
</m:properties>
</content>
</entry>
My assumption here is that the item id is either the value of the <id> tag or the value of the <UniqueId> tag, but neither have worked.
First you should set Accept header to application/json for your request so the result will be a bit better to read.
Item ID is an incremental integer in the library. You can add column ID to a view in the library to see the value for each file. From some reason this ID is missing in the response you get when the file is uploaded.
To get item by ID (best option) use:
/_api/web/lists/getByTitle('Drop Off Library')/items(1)
To get item by server relative url (also fine option) use:
/_api/web/getFileByServerRelativeUrl('/DropOffLibrary/b.txt')
UniqueId is a guid which cannot be easily used for querying the item. You would have to use $filter parameter, but it is not optimal due to performace impact.
/_api/web/lists/getByTitle('Drop Off Library')/items?$filter=GUID eq guid'2bdd4e2d-79c8-4f6b-8dd7-ac745d9360a8'
Related
I have created the following social media snippet with sulu (headless cms) and now I want to use it in my twig.html file. The only problem is that I don't understand which variables I use to get it running. I have tried a variety of different ways but I just don't understand what variables I need to use so that I can link the social media links correctly. Thanks in advance for the help.
I use sulu as headless cms, and symfony/twig to render it.
This is the Sulu code I have:
<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">
<key>socialmedia</key>
<meta>
<title lang="en">Social Media</title>
<title lang="de">Social Media</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
<tag name="sulu.node.name"/>
</property>
<property name="facebookImage" colspan="3" type="single_media_selection">
<meta>
<title lang="en">Facebook Icon</title>
<title lang="de">Facebook Icon</title>
</meta>
</property>
<property name="facebookLink" colspan="9" type="url">
<meta>
<title lang="en">Facebook Link</title>
<title lang="de">Facebook Link</title>
</meta>
<params>
<param name="schemes" type="collection">
<param name="http://"/>
<param name="https://"/>
</param>
</params>
</property>
<property name="instagramImage" colspan="3" type="single_media_selection">
<meta>
<title lang="en">Instagram Icon</title>
<title lang="de">Instagram Icon</title>
</meta>
</property>
<property name="instagramLink" colspan="9" type="url">
<meta>
<title lang="en">Instagram Link</title>
<title lang="de">Instagram Link</title>
</meta>
<params>
<param name="schemes" type="collection">
<param name="http://"/>
<param name="https://"/>
</param>
</params>
</property>
<property name="googleImage" colspan="3" type="single_media_selection">
<meta>
<title lang="en">Google Icon</title>
<title lang="de">Google Icon</title>
</meta>
</property>
<property name="googleLink" colspan="9" type="url">
<meta>
<title lang="en">Google Link</title>
<title lang="de">Google Link</title>
</meta>
<params>
<param name="schemes" type="collection">
<param name="http://"/>
<param name="https://"/>
</param>
</params>
</property>
</properties>
So you can create in your page a snippet_selection or single_snippet_selection to embed a snippet into your page.
If you want to create a snippet which is "global". You can create a snippet area / default snippet.
This means you add a area to your snippet:
<areas>
<area key="settings">
<meta>
<title lang="en">Settings</title>
</meta>
</area>
</areas>
Then you go into the Sulu Admin and create a new snippet. After that you go to your Webspace and select unter "Default Snippets" under the point "Settings" the new snippet.
In your twig you can then load that snippet via the sulu_snippet_load_by_area.html twig function:
{% set snippet = sulu_snippet_load_by_area('settings') %}
{% if snippet %} {# if null content manager did not choice a default snippet in "Default Snippets" Tabs on Webspace #}
{{ dump(snippet) }} {# dump all properties #}
{% endif %}
PS: Try not to create a default/global snippet for every little things. Mostly it is for the "Content Manager" more usable to create 1 "Settings" snippet. Which you have a Section "Social Links" in it instead of having different default snippets.
I would like register event listener let say listener for event when worksheet changed. But listener should be automatically registered when to office addin is initialized.
I have known that with open of the taskpane you can register the listener but this is not my case. Actually what I tried to do is registered event listener when the function file is loaded and not sure if this is correct way.
I would appreciate any suggestions how can be reached this solution if can be possible.
Here is example of function file.
Html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<!-- Office JavaScript API -->
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
<script type="text/javascript" src="../function-file.js"></script>
</head>
<body>
<!-- NOTE: The body is empty on purpose. Since function in function-file.js are
invoked via a button, there is no UI to render. -->
</body>
</html>
Typescript file
(() => {
// The initialize function must be run each time a new page is loaded
Office.initialize = () => {
$(document).ready(function () {
registerWorksheetChangedHandler()
/* the rest of your code here */
})
};
// Add any ui-less function here
})();
//Worksheet changed cell events
function registerWorksheetChangedHandler() {
Excel.run(function (context) {
var worksheet = context.workbook.worksheets.getActiveWorksheet()
worksheet.onChanged.add(handleWorksheetChanged);
return context.sync()
.then(function () {
console.log("Event handler successfully registered for onWorksheetChanged event in the worksheet.");
});
}).catch(error => console.log("Error: " + error));
}
function handleWorksheetChanged(event)
{
return Excel.run(function(context){
return context.sync()
.then(function() {
console.log("Change type of event: " + event.changeType);
console.log("Address of event: " + event.address);
console.log("Source of event: " + event.source);
}).catch(error => console.log("Error: " + error));
})
}
Manifest
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
xsi:type="TaskPaneApp">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>edcf304e-2101-4a0f-8306-7b34608f886a</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>CSSoft a.s.</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="CSSoft Office Addin" />
<Description DefaultValue="CSSoft Office Addin"/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-80.png"/>
<!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
<!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]">-->
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>AppDomain1</AppDomain>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
<Hosts>
<Host Name="Workbook" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/index.html" />
</DefaultSettings>
<!-- End TaskPane Mode integration. -->
<Permissions>ReadWriteDocument</Permissions>
<!-- Begin Add-in Commands Mode integration. -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<!-- The Hosts node is required. -->
<Hosts>
<!-- Each host can have a different set of commands. -->
<!-- Excel host is Workbook, Word host is Document, and PowerPoint host is Presentation. -->
<!-- Make sure the hosts you override match the hosts declared in the top section of the manifest. -->
<Host xsi:type="Workbook">
<!-- Form factor. Currently only DesktopFormFactor is supported. -->
<DesktopFormFactor>
<!--"This code enables a customizable message to be displayed when the add-in is loaded successfully upon individual install."-->
<GetStarted>
<!-- Title of the Getting Started callout. resid points to a ShortString resource -->
<Title resid="CSSoft.GetStarted.Title"/>
<!-- Description of the Getting Started callout. resid points to a LongString resource -->
<Description resid="CSSoft.GetStarted.Description"/>
<!-- Point to a url resource which details how the add-in should be used. -->
<LearnMoreUrl resid="CSSoft.GetStarted.LearnMoreUrl"/>
</GetStarted>
<!-- Function file is a HTML page that includes the JavaScript where functions for ExecuteAction will be called.
Think of the FunctionFile as the code behind ExecuteFunction. -->
<FunctionFile resid="CSSoft.DesktopFunctionFile.Url" />
<!-- PrimaryCommandSurface is the main Office Ribbon. -->
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<!-- Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab. -->
<!-- <OfficeTab id="TabHome"> -->
<CustomTab id="CSSoft.CustomTab">
<!-- Ensure you provide a unique id for the group. Recommendation for any IDs is to namespace using your company name. -->
<Group id="CSSoft.Group">
<!-- Label for your group. resid must point to a ShortString resource. -->
<Label resid="CSSoft.GroupLabel" />
<!-- Icons. Required sizes 16,32,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX. -->
<!-- Use PNG icons. All URLs on the resources section must use HTTPS. -->
<Icon>
<bt:Image size="16" resid="CSSoft.tpicon_16x16" />
<bt:Image size="32" resid="CSSoft.tpicon_32x32" />
<bt:Image size="80" resid="CSSoft.tpicon_80x80" />
</Icon>
<!-- Menu example -->
<Control xsi:type="Button" id="CSSoft.Menu">
<Label resid="CSSoft.Menu.Label" />
<Tooltip resid="CSSoft.Menu.Tooltip" />
<Supertip>
<Title resid="CSSoft.Menu.Label" />
<Description resid="CSSoft.Menu.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="CSSoft.menu_16x16" />
<bt:Image size="32" resid="CSSoft.menu_32x32" />
<bt:Image size="80" resid="CSSoft.menu_80x80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>CSSoftMenuTaskPaneID</TaskpaneId>
<SourceLocation resid="CSSoft.Taskpane.Url" />
</Action>
</Control>
</Group>
<!--</OfficeTab>-->
<Label resid="CSSoft.CustomTab.Label" />
</CustomTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<!-- You can use resources across hosts and form factors. -->
<Resources>
<bt:Images>
<bt:Image id="CSSoft.tpicon_16x16" DefaultValue="https://localhost:3000/assets/icon-16.png" />
<bt:Image id="CSSoft.tpicon_32x32" DefaultValue="https://localhost:3000/assets/icon-32.png" />
<bt:Image id="CSSoft.tpicon_80x80" DefaultValue="https://localhost:3000/assets/icon-80.png" />
<bt:Image id="CSSoft.menu_16x16" DefaultValue="https://localhost:3000/assets/menu_16x16.png" />
<bt:Image id="CSSoft.menu_32x32" DefaultValue="https://localhost:3000/assets/menu_32x32.png" />
<bt:Image id="CSSoft.menu_80x80" DefaultValue="https://localhost:3000/assets/menu_80x80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="CSSoft.Taskpane.Url" DefaultValue="https://localhost:3000/index.html" />
<bt:Url id="CSSoft.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
<bt:Url id="CSSoft.DesktopFunctionFile.Url" DefaultValue="https://localhost:3000/function-file/function-file.html" />
</bt:Urls>
<!-- ShortStrings max characters==125. -->
<bt:ShortStrings>
<bt:String id="CSSoft.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
<bt:String id="CSSoft.GroupLabel" DefaultValue="Menu" />
<bt:String id="CSSoft.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
<bt:String id="CSSoft.CustomTab.Label" DefaultValue="CSSoft"/>
<bt:String id="CSSoft.Menu.Label" DefaultValue="Go Menu"/>
</bt:ShortStrings>
<!-- LongStrings max characters==250. -->
<bt:LongStrings>
<bt:String id="CSSoft.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
<bt:String id="CSSoft.GetStarted.Description" DefaultValue="CSSoft add-in loaded succesfully. Go to the CSSoft tab and click the 'Go Menu' button to get started." />
<bt:String id="CSSoft.Menu.Tooltip" DefaultValue="Access into the main menu" />
</bt:LongStrings>
</Resources>
</VersionOverrides>
<!-- End Add-in Commands Mode integration. -->
</OfficeApp>
I just added a Sales Commissions report to sitemap and it shows in classic UI but not in modern UI. When I search for it in modern UI, result returns nothing. How my sitemap node looks like in project.xml:
<SiteMapNode>
<data-set>
<relations format-version="3" relations-version="20160101" main-table="SiteMap">
<link from="MUIScreen (NodeID)" to="SiteMap (NodeID)" />
<link from="MUIWorkspace (WorkspaceID)" to="MUIScreen (WorkspaceID)" type="FromMaster" linkname="workspaceToScreen" split-location="yes" updateable="True" />
<link from="MUISubcategory (SubcategoryID)" to="MUIScreen (SubcategoryID)" type="FromMaster" updateable="True" />
<link from="MUITile (ScreenID)" to="SiteMap (ScreenID)" />
<link from="MUIWorkspace (WorkspaceID)" to="MUITile (WorkspaceID)" type="FromMaster" linkname="workspaceToTile" split-location="yes" updateable="True" />
<link from="MUIArea (AreaID)" to="MUIWorkspace (AreaID)" type="FromMaster" updateable="True" />
<link from="MUIPinnedScreen (NodeID, WorkspaceID)" to="MUIScreen (NodeID, WorkspaceID)" type="WeakIfEmpty" isEmpty="Username" />
<link from="MUIFavoriteWorkspace (WorkspaceID)" to="MUIWorkspace (WorkspaceID)" type="WeakIfEmpty" isEmpty="Username" />
</relations>
<layout>
<table name="SiteMap">
<table name="MUIScreen" uplink="(NodeID) = (NodeID)">
<table name="MUIPinnedScreen" uplink="(NodeID, WorkspaceID) = (NodeID, WorkspaceID)" />
</table>
<table name="MUITile" uplink="(ScreenID) = (ScreenID)" />
</table>
<table name="MUIWorkspace">
<table name="MUIFavoriteWorkspace" uplink="(WorkspaceID) = (WorkspaceID)" />
</table>
<table name="MUISubcategory" />
<table name="MUIArea" />
</layout>
<data>
<SiteMap>
<row Position="1.5" Title="Sales Commissions" Url="~/Frames/ReportLauncher.aspx?ID=SO646000.rpx" Expanded="0" IsFolder="0" ScreenID="SO646000" NodeID="972cf181-504a-4df7-88d1-c4cb1a0c93d4" ParentID="85e0f6b3-8ae8-43aa-ad7b-ea4d4d5f381e" />
</SiteMap>
</data>
</data-set>
</SiteMapNode>
And a screenshot of my site map directory:
https://drive.google.com/open?id=1wp2xWqdx-0lbGE7xfDuD6bhtLrK1-I7i
Any ideas what might be happening? I tried recreating site map entry several times and still nothing.
You have to add it to the work space after adding to the sitemap. Just because you add it to the sitemap does not automatically add it to the new UI.
The help articles should help to walk you through editing the new UI. Here is an article that might help:
To Add a Link to a Workspace
More help...
Customizing the Modern User Interface
Workspaces in the Modern UI
Edit: If you already added the sitemap to your customization and later add the entry to a workspace, you need to update the sitemap entry in your customization project by reloading from the database (option under sitemap).
Think I have messed up the config file for the dashboard.
Error -
No loaded type is marked up with a Reflector Type attribute that matches the XML node(dashboard).
Error comes up when I validate the dashboard.config file in the CC Validator.
This is my dashboard.config file
<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>
</cruisecontrol>
Can anyone please help me on this, and also some tips on how to resolve similar issues would be helpful.
Your dashboard.config file looks a little strange, i dont think it should contain the cruisecontrol node.
I think it should be:
<?xml version="1.0" encoding="utf-8"?>
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>
Background
Our email vendor supports rss feeds for dynamic content, which we use successfully for "daily headline" type emails. This is a great help in automating many different emails that we don't have staffing to create daily. One of our staff as requested that his daily email (which has recent headlines from his Movable Type blog) only have headlines from entries posted on that day.
My Question
Since we use Movable Type for his blog, is there a way to generate a rss feed that only contains items posted on the current day?
Your solution can be simplified by using the "days" parameter on mt:Entries:
<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><$MTBlogName remove_html="1" encode_xml="1"$></title>
<link rel="alternate" type="text/html" href="<$MTBlogURL encode_xml="1"$>" />
<link rel="self" type="application/atom+xml" href="<$MTBlogURL$>atom.xml" />
<id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id>
<link rel="service.post" type="application/atom+xml" href="<$MTCGIPath$><$MTAtomScript$>/weblog/blog_id=<$MTBlogID$>" title="<$MTBlogName encode_html="1"$>" />
<updated><MTEntries lastn="1"><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTEntries></updated>
<MTIfNonEmpty tag="MTBlogDescription"><subtitle><$MTBlogDescription remove_html="1" encode_xml="1"$></subtitle></MTIfNonEmpty>
<generator uri="http://www.sixapart.com/movabletype/">Movable Type <$MTVersion$></generator>
<MTEntries days="1">
<entry>
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>" />
<link rel="service.edit" type="application/atom+xml" href="<$MTCGIPath$><$MTAtomScript$>/weblog/blog_id=<$MTBlogID$>/entry_id=<$MTEntryID$>" title="<$MTEntryTitle encode_html="1"$>" />
<id><$MTEntryAtomID$></id>
<published><$MTEntryDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
<updated><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
<summary><$MTEntryExcerpt remove_html="1" encode_xml="1"$></summary>
<author>
<name><$MTEntryAuthorDisplayName encode_xml="1"$></name>
<MTIfNonEmpty tag="MTEntryAuthorURL"><uri><$MTEntryAuthorURL encode_xml="1"$></uri></MTIfNonEmpty>
</author>
<MTEntryCategories>
<category term="<$MTCategoryLabel encode_xml="1"$>" />
</MTEntryCategories>
<content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTBlogURL encode_xml="1"$>">
<$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$>
</content>
</entry>
</MTEntries>
No need for checking the date yourself, this also removes the empty "entry" tags your version creates.
Okay, so i figured it out myself.
First I had to create a new feed, which i named "daily.xml" and copied the default code from atom.xml into it. Then I used setvarblock to define variables for the current date and publish date. Once this was done I used if to compare the 2 variables, and show the ones that matched.
code:
<?xml version="1.0" encoding="<$MTPublishCharset$>"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><$MTBlogName remove_html="1" encode_xml="1"$></title>
<link rel="alternate" type="text/html" href="<$MTBlogURL encode_xml="1"$>" />
<link rel="self" type="application/atom+xml" href="<$MTBlogURL$>atom.xml" />
<id>tag:<$MTBlogHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y"$>:<$MTBlogRelativeURL encode_xml="1"$>/<$MTBlogID$></id>
<link rel="service.post" type="application/atom+xml" href="<$MTCGIPath$><$MTAtomScript$>/weblog/blog_id=<$MTBlogID$>" title="<$MTBlogName encode_html="1"$>" />
<updated><MTEntries lastn="1"><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></MTEntries></updated>
<MTIfNonEmpty tag="MTBlogDescription"><subtitle><$MTBlogDescription remove_html="1" encode_xml="1"$></subtitle></MTIfNonEmpty>
<generator uri="http://www.sixapart.com/movabletype/">Movable Type <$MTVersion$></generator>
<MTEntries lastn="15">
<entry>
<!-- this sets the current date to a variable named "TodaysDate" -->
<mt:setvarblock name="TodayDate"><$mt:Date format="%Y%m%d"></mt:setvarblock>
<!-- this sets the entry publish date to a variable named "PublishedDate" -->
<mt:setvarblock name="PublishedDate"><$mt:EntryDate format="%Y%m%d"></mt:setvarblock>
<!-- starts an IF statement comparing equality of "PublishedDate" and "TodayDate". note: for some reason the second variable needs to have an '$' added to the front -->
<mt:if name="PublishedDate" eq="$TodayDate">
<!-- the rest of this (except the end of the IF statement) is copied from default template -->
<title><$MTEntryTitle remove_html="1" encode_xml="1"$></title>
<link rel="alternate" type="text/html" href="<$MTEntryPermalink encode_xml="1"$>" />
<link rel="service.edit" type="application/atom+xml" href="<$MTCGIPath$><$MTAtomScript$>/weblog/blog_id=<$MTBlogID$>/entry_id=<$MTEntryID$>" title="<$MTEntryTitle encode_html="1"$>" />
<id><$MTEntryAtomID$></id>
<published><$MTEntryDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></published>
<updated><$MTEntryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></updated>
<summary><$MTEntryExcerpt remove_html="1" encode_xml="1"$></summary>
<author>
<name><$MTEntryAuthorDisplayName encode_xml="1"$></name>
<MTIfNonEmpty tag="MTEntryAuthorURL"><uri><$MTEntryAuthorURL encode_xml="1"$></uri></MTIfNonEmpty>
</author>
<MTEntryCategories>
<category term="<$MTCategoryLabel encode_xml="1"$>" />
</MTEntryCategories>
<content type="html" xml:lang="<$MTBlogLanguage ietf="1"$>" xml:base="<$MTBlogURL encode_xml="1"$>">
<$MTEntryBody encode_xml="1"$>
<$MTEntryMore encode_xml="1"$>
</content>
<!-- end of our IF statement -->
</mt:if>
</entry>
</MTEntries>
</feed>