2017-09-08 1 views
0

SharePoint 목록에서 일부 정보를 쿼리하려고합니다. 자, 나는 그것을 얻기 위해 odata를 사용하려고 노력하고 있습니다. 내 문제는 어떤 이유로, $ 필터가 그 목록에있는 모든 키와 함께 작동하지 않는다는 것입니다.

이 작동 확인 :

  1. ... CCM/_api /리스트/GetByTitle ('회로 % 20Deliveries')/항목 $ 필터 = 제목 EQ '8월 여기에 예입니다 '

하지만이 하나가 작동하지 않습니다 (HTTP 400 잘못된 요청)

  1. .. 내가 선택하고 ORDERBY로 사용할 수 있어요 이후 .ccm/_api /리스트/GetByTitle ('회로 % 20Deliveries')/항목? $ 필터 = Delivery_x0020_Date EQ 널

그럼에도 불구하고, 필드 이름은 OK입니다 같은 필드 명. 여기에 2 '제목'라는 이름 8월에 대한 IE에서 XML 출력은 다음과 같습니다

... CCM/_api /리스트/GetByTitle ('회로 % 20Deliveries')/항목 $ 필터 = 제목 EQ '8월? 당신은 내가 성공적으로 쿼리와 b를 선택 할 수 있었다 볼 수 있듯이 '&는 $ = 제목, Delivery_x0020_Date, Status_x0020__x002d__x0020_Calcu

<?xml version="1.0" encoding="utf-8" ?> - 
 
<feed xml:base="/ccm/_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>5a2630a8-c00a-4baa-bd43-3912d9264df8</id> 
 
    <title /> 
 
    <updated>2017-09-08T10:58:12Z</updated> 
 
    <entry m:etag="" 33 ""> 
 
    <id>Web/Lists(guid'5ad8ca39-191a-4586-bdef-7bc4830eced9')/Items(332)</id> 
 
    <category term="SP.Data.Circuit_x0020_DeliveriesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
 
    <link rel="edit" href="Web/Lists(guid'5ad8ca39-191a-4586-bdef-7bc4830eced9')/Items(332)" /> 
 
    <title /> 
 
    <updated>2017-09-08T10:58:12Z</updated> 
 
    <author> 
 
     <name /> 
 
    </author> 
 
    <content type="application/xml"> 
 
     <m:properties> 
 
     <d:Title>AUG</d:Title> 
 
     <d:Delivery_x0020_Date m:type="Edm.DateTime">2017-03-06T06:00:00Z</d:Delivery_x0020_Date> 
 
     <d:Status_x0020__x002d__x0020_Calcu>Circuit Ready for Production Use on 03/06/2017</d:Status_x0020__x002d__x0020_Calcu> 
 
     </m:properties> 
 
    </content> 
 
    </entry> 
 
    <entry m:etag="" 58 ""> 
 
    <id>Web/Lists(guid'5ad8ca39-191a-4586-bdef-7bc4830eced9')/Items(333)</id> 
 
    <category term="SP.Data.Circuit_x0020_DeliveriesListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> 
 
    <link rel="edit" href="Web/Lists(guid'5ad8ca39-191a-4586-bdef-7bc4830eced9')/Items(333)" /> 
 
    <title /> 
 
    <updated>2017-09-08T10:58:12Z</updated> 
 
    <author> 
 
     <name /> 
 
    </author> 
 
    <content type="application/xml"> 
 
     <m:properties> 
 
     <d:Title>AUG</d:Title> 
 
     <d:Delivery_x0020_Date m:null="true" /> 
 
     <d:Status_x0020__x002d__x0020_Calcu>Site Survey completed on 09/09/2016</d:Status_x0020__x002d__x0020_Calcu> 
 
     </m:properties> 
 
    </content> 
 
    </entry> 
 
</feed>

을 선택 목록에서 o 번째 필드를 선택하고 제목으로 필터링하십시오. 그럼에도 불구하고 Delivery_x0020_Date가 비어있는 경우 (또는 null 인 경우) 필터링을 추가로 수행하고 싶습니다.

나는 주위를 수색하고 어떤 사람들은 날짜에 null로 필터링하는 것이 항상 효과가있는 것은 아니라고 말하고 있었다. 내가 다른 키를 필터링하려고해도 (Status_x0020__x002d__x0020_Calcu) 당신이에 필터링 할 수 있습니다 키의 유형에 대한 요구 사항이 있습니까 잘못된 요청

반환하기 때문에하지만 내 경우에, 그보다 약간 더? 감사합니다.

답변

0

SharePoint 2013의 REST API는 목록 항목 쿼리에서 필터링에 null 값을 지원하지 않습니다. (MSDN 링크 참조)

다른 해결 방법을 찾아야합니다.

그러나 CAMA 쿼리를 REST API와 결합하여 Javascript 개체 모델에서 필요한 데이터를 가져올 수 있습니다. 이 링크 - REST API to filter on null을 참조하십시오.

하지만 C# 코드에 대해 잘 모르겠습니다.

+0

답변 해 주셔서 감사합니다. 하지만 내 경우에는 null 값에 관한 것이 아닙니다. 예를 들어이 걸릴 : '... CCM/_api /리스트/GetByTitle ('회로 % 20Deliveries')/항목 $ 필터 = substringof ('회로 준비를 생산에 사용', Status_x0020__x002d__x0020_Calcu)' 이도를? 나쁜 요청을 반환합니다 : S – Redespace

관련 문제