Graph API retrieve Sharepoint list with lookup field values - sharepoint

I have a Sharepoint list Region with a value that is a lookup field Markets that references Markets list.
I'm able to filter by the lookup ID:
https://graph.microsoft.com/v1.0/sites/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/lists/REGION/items?expand=fields(select=PVRegion,Markets)&filter=fields/MarketsLookupId eq 1
But I want to get some fields from Markets list with this lookup attribute, as PVOps, LinkTitle, ...
Is it possible to get this with only one query? Or I need to query Markets list with the LookupId?

Unfortunately you'll need a separate query to get those values. This is particularly frustrating when dealing with users since you only get the ID of the given user as it appears in the UserInformation list.

Related

Microsoft Graph API $filter=name eq 'foo' query not working on GET workbook/tables/{id}/columns. No error and no filtering

I'm looking at a table (Table1) inside an Excel book saved on my OneDrive for Business account. I then want to get the maximum value in the CREATEDDATE column from this table.
I want to avoid pulling down the whole table with the API, so I'm trying to filter the results of my query to only the CREATEDDATE column. However, the column results from the table are not being filtered to the one column and I'm not getting an error to help troubleshoot why. All I get is an HTTP 200 response and the full unfiltered table results.
Is it possible to filter the columns retrieved from the API by the column name? The documentation made me think so.
I've confirmed that /columns?$select=name works correctly and returns just the name field, so I know that it recognizes this as an entity. $filter and $orderby do nothing when referencing any of the entities from the response (name, id, index, values). I know that I can limit columns by position, but I'd rather explicitly reference the column by name in case the order changes.
I'm using this query:
/v1.0/me/drive/items/{ID}/workbook/tables/Table1/columns?$filter=name eq 'CREATEDDATE'`
You don't need to $filter here, just pull it by the name directly. The prototypes from the Get TableColumn documentation are:
GET /workbook/tables/{id|name}/columns/{id|name}
GET /workbook/worksheets/{id|name}/tables/{id|name}/columns/{id|name}
So in your case, you should be able to simply call call:
/v1.0/me/drive/items/{ID}//workbook/tables/Table1/columns/CREATEDDATE

Can I get relating resources by SharePoint REST API?

There is an API to get relating resources in OData, the Url likes this: http://services.odata.org/V4/(S(34wtn2c0hkuk5ekg0pjr513b))/TripPinServiceRW/People('russellwhyte')/Trips(0).
Can I use it in SharePoint, or is there any other API likes this to get relating resources?
Thank you for your advises!
P.S. I know that I can use Lookup field and Expand to get resources, but it cannot meet my requirements.
I have List A and List B, List B is a task list. so how can I get relating tasks when I get each item form List A by one request?
I know that I can use expand, likes ~/_api/web/lists/getbytitle('List B')/items?$select=ListA/Title,ListA/Field0...&$expand=ListA. But I don't want to get data from List B, cause I need to filter data by current user's permissions in List A.
Since the lookup is in List B and you are querying List A there is not one request to retrieve the info you are looking for. If the Lookup was in List A you could see all the List B items. Without that, you need to first query all the List B items and return all the List A item ID's, then query List A.
_api/web/lists/GetByTitle('List B')?$select=lookupColumn/Id&$expand=lookupColumn/Id
_api/web/lists/GetByTitle('List A')?$filter=Id eq 'someID' or Id eq 'someID2'

SharePoint unique values from lookup

I have a list with a lookup column that is getting "Created" dates from another list, but I only want the unique date values. Is there a way to get this data or to create a calculated column with unique values?
A lookup field actually links to a single item, the display value is more a "human readable" value for the link to the items ID value.
You may also get some mileage from a normal text or even date field and using jQuery and SPServices on the edit and new forms in order to provide changes to the form for the user. This avoids doing a code level customisation for the site that a Custom Field would require.
Not out of the box I dont think. My best bet is to create a Custom Field type that extends lookup with the functionality you are after.

Add up values from matching fields in a linked Sharepoint list

I have 2 lists, say, Fruits & Orders.
Orders has a number field FruitID that links to the ID field of Fruits.
Orders also has a number field OrderValue which stores the value of the specific order.
I want to find out the total sale for a particular fruit. I am doing this calculation in a workflow for the specific fruit. Is there an easy way (read 'no coding')?
See the list of standard workflow actions here:
http://office.microsoft.com/en-us/sharepoint-designer-help/workflow-actions-in-sharepoint-designer-2010-a-quick-reference-guide-HA010376961.aspx
There is no select, or looping functionality.
I suggest writing a custom workflow activity, sand boxing should work
http://www.wictorwilen.se/Post/Sandboxed-workflow-activities-in-SharePoint-2010.aspx

SharePoint Lookup field, what is it?

SharePoint Lookup field, what is it?
Please share, thanks.
It is a type of field used to indicate that the possible values of a column in a list must be taken from the elements of another list. For example, if you have a list of users, and one column of this list is the country, you can create a lookup field pointing to another list "countries" which contains the possible values to select.
If you think in terms of relational databases, a lookup field is a foreign key: you only store a reference to the related item, not its value.
For instance, you have a list of meeting rooms. You can create a meeting calendar by creating a new calendar list with a lookup to the "Meeting rooms" list. Hence, when organizing a meeting, you will be able to pick a room from the list of meeting rooms entered previously.
A "Lookup" differs from "Choice" field as you may alter the source item and the referencing item is updated automatically. For instance, you change the name of a meeting room - all meetings booked for that room will show the new title automatically.

Resources