首页 \ 问答 \ SharePoint REST _api DateTimeRange查询(SharePoint REST _api DateTimeRange query)

SharePoint REST _api DateTimeRange查询(SharePoint REST _api DateTimeRange query)

我有一个包含数据类型DateTime开始日期和结束日期列表。 我想构造一个查询,以获取在查询日期范围内具有开始日期or结束日期的所有事件。 问题是查询使用and 。 所以我只能在日期范围查询中获得开始和结束日期的事件。 我试图替换andor但我只在控制台中获得Unexpected token 。 我看了文档 。 但解决不了。 有什么建议么?

这是我的代码:

        var DateRAngeFormat = 'YYYY-MM-DDT00';

        var ThreeMonthsEarlier = moment().add(-3, 'months').format(DateRAngeFormat),
            ThreeMonthsFromNow = moment().add(3, 'months').format(DateRAngeFormat);

        var url = `${_spPageContextInfo.webAbsoluteUrl}/_api/web/lists/getbytitle('Program')/items?$select=Title%2CKontaktperson%2CBokning_x0020_till%2CBokning_x0020_fr_x00e5_n%2CMax_x0020_antal_x0020_platser%2CID&$filter=Bokning_x0020_fr_x00e5_n%20ge%20datetime'${ThreeMonthsEarlier}%3A00%3A00'%20and%20Bokning_x0020_till%20le%20datetime'${ThreeMonthsFromNow}%3A00%3A00'`;

EDIT

我使用CAML查询(服务器端代码)进行查询,得到我想要的结果。 所以我的猜测是可以使用REST _api,我只需要弄清楚如何。

 var q = new CamlQuery() { ViewXml = "<View><Query><Where><Or><Gt><FieldRef Name='Bokning_x0020_fr_x00e5_n' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2017-10-03T00:28:05Z</Value></Gt><Lt><FieldRef Name='Bokning_x0020_till' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2010-04-02T00:28:08Z</Value></Lt></Or></Where></Query></View>"};

I have a list with start dates and end dates columns with the data type DateTime. I want to construct a query that fetches all events that have the start date or the end date within the query date range. The problem is that the query uses and. So I only get events with start and end dates within the date range query. I tried replacing the and with or but I only get Unexpected token in the console. I looked at the docs. But could not solve it. Any suggestions?

This is my code:

        var DateRAngeFormat = 'YYYY-MM-DDT00';

        var ThreeMonthsEarlier = moment().add(-3, 'months').format(DateRAngeFormat),
            ThreeMonthsFromNow = moment().add(3, 'months').format(DateRAngeFormat);

        var url = `${_spPageContextInfo.webAbsoluteUrl}/_api/web/lists/getbytitle('Program')/items?$select=Title%2CKontaktperson%2CBokning_x0020_till%2CBokning_x0020_fr_x00e5_n%2CMax_x0020_antal_x0020_platser%2CID&$filter=Bokning_x0020_fr_x00e5_n%20ge%20datetime'${ThreeMonthsEarlier}%3A00%3A00'%20and%20Bokning_x0020_till%20le%20datetime'${ThreeMonthsFromNow}%3A00%3A00'`;

EDIT

I made a query using CAML query (serverside code) and I get the result I want. so my guess is that it is possible using the REST _api, I just have to figure out how.

 var q = new CamlQuery() { ViewXml = "<View><Query><Where><Or><Gt><FieldRef Name='Bokning_x0020_fr_x00e5_n' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2017-10-03T00:28:05Z</Value></Gt><Lt><FieldRef Name='Bokning_x0020_till' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2010-04-02T00:28:08Z</Value></Lt></Or></Where></Query></View>"};

原文:https://stackoverflow.com/questions/48067562
更新时间:2023-03-31 06:03

最满意答案

好的想出了一个适合我使用ssh的方法。

将本地项目.git文件夹复制到远程服务器目录上的项目。 您可能必须复制到具有正确权限的文件夹,然后移动.git文件夹

scp /local/path/to/.git user@remote:/remote/path/to/temp/folder

更改.git的所有权并将其移动到现有项目目录

chown -R www-data:www-data .git/
mv .git/ /var/www/....

执行git状态会显示已更改的文件和未跟踪的文件。 在我的情况下,'更改'文件是我想要覆盖的旧文件,以及我在.gitignore中指定的文件的未跟踪文件。

所以要将文件“恢复”到分支中的新版本(存储在.git文件夹中)并忽略未跟踪的文件,我只是做了

git checkout .

这也添加了.gitignore文件,我也不得不说。

这是在一个只有一个主分支的项目上测试的,但我希望这有助于未来的人们。 我的术语可能稍微有点描述git进程,但希望每个人都能了解情况。


Ok figured out a method that worked for me using ssh.

Copy the local projects .git folder to the project on the remote servers directory. You may have to copy to a folder with correct privileges then move the .git folder

scp /local/path/to/.git user@remote:/remote/path/to/temp/folder

Change the ownership of the .git and move it to the existing projects directory

chown -R www-data:www-data .git/
mv .git/ /var/www/....

Performing a git status shows the changed files and untracked files. In my case the 'changed' files were the old files I wanted to overwrite, and the untracked files where the files I specified in .gitignore.

So to 'revert' the files to the new versions in the branch (stored in the .git folder) and ignore the untracked files, I just did

git checkout .

This also added the .gitignore file, which I had to chown too.

This was tested on a project with only a master branch, but I hope this helps people in the future. My terminology may be a little off describing the git processes but hopefully everyone gets the picture.

相关问答

更多
  • git clone接受最后一个参数是目标目录,默认情况下是项目名称,但可以更改它。 在你的情况下,你可能很简单. : $ git clone origin-url . 但是请注意,从man git-clone : 只有当目录为空时才允许克隆到现有目录。 git clone accepts a last argument that is the destination directory, it is by default the name of the project but you can change ...
  • 实际上git v.1.7.0似乎确实存在foldernames的问题。 使用此.git / info / sparse-checkout实际上可以正常工作 include/ htdocs/* !htdocs/downloads/ !htdocs/images/ !htdocs/videos/ 因此,我的Mac上不需要使用较新的Git版本,但在具有较旧Git的Linux服务器上不需要尾部斜杠。 Actually git v.1.7.0 does seem to have problems with fold ...
  • 这可以通过克隆到新目录,然后将.git目录移动到现有目录中。 如果您现有的目录命名为“代码”。 git clone https://myrepo.com/git.git temp mv temp/.git code/.git rm -rf temp 这也可以在克隆命令期间不执行检出来完成; 更多的信息可以在这里找到。 This can be done by cloning to a new directory, then moving the .git directory into your existi ...
  • 好的想出了一个适合我使用ssh的方法。 将本地项目.git文件夹复制到远程服务器目录上的项目。 您可能必须复制到具有正确权限的文件夹,然后移动.git文件夹 scp /local/path/to/.git user@remote:/remote/path/to/temp/folder 更改.git的所有权并将其移动到现有项目目录 chown -R www-data:www-data .git/ mv .git/ /var/www/.... 执行git状态会显示已更改的文件和未跟踪的文件。 在我的情况下, ...
  • 克隆项目一个接一个: git svn clone -s https://remote-svn/svn/project/Project1 git svn clone -s https://remote-svn/svn/project/Project2 git svn clone -s https://remote-svn/svn/project/Project3 … Clone projects one by one: git svn clone -s https://remote-svn/svn/proj ...
  • 虽然可以使用sudo并定义特定的命令,但我建议不要这样做:这个设置听起来容易错误配置或破坏。 我建议你每隔几分钟就有一个cron工作运行git pull 。 While it is possible using sudo and defining specific commands, I'd recommend against it: This setup sounds easy to misconfigure or break. I'd recommend that you have a cron job ...
  • 一种选择是将目录CCC放入其自己的存储库中,然后使用git submodule将其添加回Repo1和Repo2。 如果需要保留其历史记录,可以使用git filter-branch从历史记录中将CCC从Repo2提取到自己的存储库中。 One option is to put the directory CCC into its own repository, and then use git submodule to add it back into Repo1 and Repo2. You can ex ...
  • 克隆git存储库时,您始终会克隆整个存储库。 如果您想在项目中使用子文件夹,只需创建它们即可。 只要你在里面添加文件(git只跟踪没有文件夹的文件 - >如果一个文件夹是空的,你不能将它添加到你的repo中),它们可以通过提交里面的文件来提交到你的版本库。 I found an answer: http://blog.quilitz.de/2010/03/checkout-sub-directories-in-git-sparse-checkouts/ I had git 1.5.5, and it req ...
  • 我发现文件确实被移动了。 我需要关闭所有打开的项目文件,然后再次从包资源管理器打开它们(这将从git存储库打开文件)。 I found out that the files really get moved. I needed to close all the open project files and then open them from package explorer again (which will open the files from git repository).
  • 如果您正在使用Composer,并且没有特殊要求将依赖项包含在您自己的存储库中,我认为遵循Composer开发人员的建议不要在您自己的存储库中包含vendor文件夹是一个好主意,但只添加并提交composer.lock文件。 将行vendor/添加到最顶层目录中的.gitignore文件中,基本完成。 更多信息: https : //getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md If y ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。