Strange 'lastModifiedDateTime' object when requesting a sharepoint site with microsoft graph api - sharepoint

I am trying to detect sharepoint sites in Office 365 not visited last 180 days.
With this purpose I query sharepoint sites using a microsoft graph api query like this:
GET https://graph.microsoft.com/v1.0/sites?search=
which returns an JSON object where object['value'] is the first portion of site objects and object['#odata.nextLink'] is the link to the next portion of site objects (as I understand from what I see in the output)
When I view site objects which look like this:
'id': 'mytenant.sharepoint.com,29c17bd8-db42-430d-b5ba-b55d15885790,6302ea22-aa16-4e12-bd50-6e7094fc65cd',
'lastModifiedDateTime': '0001-01-01T08:00:00Z',
'name': 'TEST_MODIFIED_DATE',
'webUrl': 'https://mytenant.sharepoint.com/sites/TEST_MODIFIED_DATE',
'displayName': 'TEST_MODIFIED_DATE',
'root': {},
'siteCollection': {'hostname': 'mytenant.sharepoint.com'}}
in a loop I can see 'lastModifiedDateTime' property which may (or may not) be what I am looking for. Some sites and this one in particular have a strange value of 'lastModifiedDateTime':
'lastModifiedDateTime': '0001-01-01T08:00:00Z'
What does this strange datetime value mean?
Does it mean the last time the site was visited at all? It does not correspond with the value I can see in Sharepoint web interface ('last activity' column, which is now empty for this site)?

You can try using the 'id' that you have got from the search query and try to use that site id in the following query. https://graph.microsoft.com/v1.0/sites{siteid} You can get the right lastModifiedDateTime as shown below.
Please go through this document.

Related

Is there a way to send a filter to a Sharepoint List and view the results in a web part?

I've been tasked with setting up an advanced filter for a customer facing portal - as part of this, I have filters set up for various tags such as Priority, Site, Application, Reference. I've come up with a way to generate a URL that goes to the list and sets the filters to the selections given, by giving an html navigation command using a JavaScript function to splice together the URL.
This works fine for use within my team, however customers shouldn't have full access to our lists, and we have a customer-facing portal that currently has a limited view of these lists displayed to them, with much fewer details and none of our internal notes. These limited views are done through a web part that displays the Soaped in view - this is where I'm wanting to have the filtered list show up, as it's a more user-friendly way to search the list for information that the customer would want.
You can add a Query String (URL) Filler Wepart to the page, configure it for the param in the URL and configure connection or the List WebPart to receive filter value from the Query String Filler.
Add QSF webpart:
Configure the WP:
Establish Connection (go to the WP Edit mode first)
Test the URL param: ...sharepoint.com/sites/dev/SitePages/TestPage.aspx?Disp=1

Microsoft Graph API SharePoint search

I have been trying to search through my SharePoint site. I am able to get results for a single drive:
xxx.sharepoint.com,xxxxxx-xxxx-xxxx-xxxx-xxxxxx,xxxxx-xxxx-xxxx-xxxx-xxxxxx/drives/xxxxxxxxx/search(q='{content}')
But if I do the same search at drive/root, I don't get any result:
xxx.sharepoint.com,xxxxxx-xxxx-xxxx-xxxx-xxxxxx,xxxxx-xxxx-xxxx-xxxx-xxxxxx/drive/root/search(q='{content}')
We basically want to perform a search across the entire subsite.
Hey a bit late but I've just discovered you can use the /sites endpoint to retrieve all items in a site by expanding relationships of graph objects. Could you try use:
https://graph.microsoft.com/v1.0/sites/root/sites?$expand=lists($expand=items)
This seems to return all list items in all subsites under the root site. You should hopefully then be able to to filter further by subsite, list, field values etc.

Why does owssvr.dll return an empty result for my list?

I am trying to use owssvr.dll and its URL API in SharePoint 2007 to get some list metadata. For most of the lists in my site of interest, I can use a url formatted like so:
http://hts-app1/compounds/_vti_bin/owssvr.dll?XMLDATA=1&List={F987723C-28A4-47D3-83D7-19094B0267DF}
I get back an xml-based list of field metadata for the default view and a list of records in the list. But when I try to use another guid for a separate list, I get an empty response from the web server. It's a 200 response code, but the other headers look like:
Connection:close
Date:Thu, 24 Mar 2011 17:38:46 GMT
MicrosoftSharePointTeamServices:12.0.0.4518
Server:Microsoft-IIS/6.0
X-Powered-By:ASP.NET
I am pretty sure the list guid is valid, since I can match it with the guid for the list I can see in the listedit.aspx page. If I also format my url like so:
http://hts-app1/compounds/_vti_bin/owssvr.dll?XMLDATA=1&List={F987723C-28A4-47D3-83D7-19094B0267DF}&Query=*
with the Query=* parameter, I can get valid xml, but it's just showing everything, and not filtered for my view, and I'd really like to have the view.
I looked in the SharePoint log file, and I couldn't find anything that looked related to this request.
So, how can I debug this? I'd really like to use a simple http GET request to get back this metadata, and owssvr.dll seemed the ideal mechanism.
You can specify a specific view as well. Like this
http://{0}/_vti_bin/owssvr.dll?Cmd=Display&List={1}&view={2}&XMLDATA=TRUE
for example:
https://foo.com/extranet/_vti_bin/owssvr.dll?Cmd=Display&List=%7B7F7AFB9D%2D6D5D%2D4626%2DBD9D%2D085957DB79AB%7D&view=%7B111EC07E%2DF648%2D443B%2D8DE6%2DB53786BE6762%7D&XMLDATA=TRUE
The absolute easiest way to get the list and view guids is to goto edit the view and snatch the list & view info directly from the address bar.
1. That supplying GUID in the querystring of your URL works for one list and does not for other is probably because the lists are on different sites. Verify that the sitename is correct and that GUID is a List ID indeed.
Be wary of the fact that, however, above applies to both SharePoint 2007 and 2010, for SharePoint 2010 additional measures might be required depending on context from which you execute commands on owssvr.dll.
2.
query=* is not a filter parameter; it shows schema as well as data for all available columns in the list, including SharePoint internal columns, which normally you never get to see in ways other than programmatic access.
3.
To get only those columns that are visible in the current default view call display command on owssvr.dll while xmldata parameter is set true; like this:
http://hts-app1/compounds/_vti_bin/owssvr.dll?Cmd=Display&List={F987723C-28A4-47D3-83D7-19094B0267DF}&XMLDATA=TRUE
Again this is for SharePoint 2007 only and depends on execution context.
4.
with the Query=* parameter, I can get
valid xml, but it's just showing
everything, and not filtered for my
view, and I'd really like to have the
view.
Oh but this is not called filtering; filtering is only based on columns values. For this use additional FilterField1 and FilterValue1 parameters.
http://hts-app1/compounds/_vti_bin/owssvr.dll"
+ "?Cmd=Display&List={F987723C-28A4-47D3-83D7-19094B0267DF}"
+ "&XMLDATA=TRUE&FilterField1=YOUR_FILTER_COLUMN_NAME&FilterValue1"
+ YOUR_FILTER_COLUMN_VALUE
Takeoff "(double quotes) and +(plus) and (returns) before testing in browser.

How does the Sitecore SharePoint Connector name its items?

Can anyone who has used the Sitecore SharePoint connector tell me how it chooses the name for the items it creates in the Sitecore tree?
I am able to map fields and sitecore values (such as __Displayname), but not the tree name.
The problem we face is that the data in SharePoint contains invalid characters that should not be allowed in the tree name.
Thanks in advance!
As far as I can see, SharePoint connector chooses Sitecore item name by iterating through the following SharePoint fields in that very order:
Title
LinkFilename
LinkTitle
NameOrTitle
URL
GUID
ID
If the field is not empty, its value is taken as an item name and the iteration stops. So you can find out where the invalid name comes from in your case. If it's NameOrTitle, for instance, then you can try to put a valid name to, let's say, Title and it should be picked by SharePoint connector.
I've never tried this myself, though. That's what I can judge about looking at the code.
Also, the documentation for SharePoint connector for Sitecore 6 is here.

Google-Analytics API to track Site Search?

So there's this nifty _trackPageview() api method on a tracker object, but is there a corresponding method that can be used to manually track a search? In other words, _trackPageview() reports to GA that a user hit a page. I want something like _trackSearch("terms") that would report to GA that a user searched for something.
Though not exactly what I was looking for, it seems that one can generate virtual page views to track search results programatically.
Suppose that you've set up a Site Search parameter called "q", so that when a URI is tracked that contains q=these+are+some+terms, GA will mark it as a search hit. One can use the _trackPageview() method to generate virtual search hits like so:
pageTracker._trackPageview('/custom/search?q=These+are+some+terms')
I pass search parameters by GET, so the URL for a search on "TEST" is
http://www.example.com/search?q=TEST
Selecting Content -> Site Search from my analytics account gives me a list of all keywords searched.
To learn more, check the documentation, especially the How do I set up Site Search for my profile? page.

Resources