Count SharePoint Documents Dynamics CRM - microsoft-dynamics

I have SharePoint Online enabled for my Dynamics CRM Online. I have a documents subgrid showing on my account form. Everytime a document is uploaded to Sharepoint from within CRM, an email should be fired to the owner of the record.
I tried using this with Flow but it is difficult as the SharePoint Folder structure is as follows: Account > AccountI_GUID
AccountII_GUID
and so on
I could have alerts in SharePoint enabled. However, I would have to do this each time a new account is created in CRM. There is 13000 accounts in CRM already. So, I would have to go into each of the folders and enable alerts.
Would you have any other solutions?
I was thinking of maybe getting a count of all the documents in SP and showing the count in CRM. If the count has changed then trigger a workflow. But I am not sure how to go about that. Please help.

I would probably go about this by creating a Powershell script to iterate through all of the account document libraries to set up an alert on each one. You could then run this at the end of each day to pick up any new accounts.
After a quick google I came up with this which may be of use Create Alerts using CSOM
I know there are also ways in Dyanamics to remove the GUID from the library but I'm no Dynamics expert so not sure what functionality this may effect.

Related

Workflow error in Sharepoint Online

I am having this error in Sharepoint Online when I run a workflow to create an Enterprise Project from a list
The details of the error was
Retrying last request. Next attempt scheduled in less than one minute.
Details of last request: HTTP Forbidden to
https://xxxxxxxxxxxxxx/sites/pwa/_api/ProjectServer/WorkflowActivities/CreateProjectFromListItem(webId='923e34ac-7127-4707-b6e1-83ac3235ef67',listId='a352ed9d-3b99-4405-b2a3-2fc3c2678335',itemId='2',eptId='09fa52b4-059b-4527-926e-99f9be96437a')
Correlation Id: f9d2736f-8a66-4425-a5cc-cb30adf980ff Instance Id:
3e7695ad-5913-4bb0-b6c8-cbf29e4e877a
PJClientCallableException: GeneralSecurityAccessDenied
GeneralSecurityAccessDenied
I tried changing my workflow to just send an email to check whether there is something wrong with the workflow but emailing work
I suspect it has something to do with the workflow engine service user (if there is such a thing) trying to create and Enterprise Project.
I and the admin so I have the full access but for some reason the workflow is running as a different user on my behalf.
It is a simple workflow and it looks like this
And the list looks like this with its mapping with the Project Web App Fields
Any reasons why this is happening?
How do I resolve the issue?
If its a workflow service user what is the user that I can give full access to creating Enterprise Projects
Since this is SharePoint Online we are talking about it leverages Azure Workflows. Impersonation is discontinued in SharePoint Designer so you will have to use the App Step, to do that you will need to first to activate Allow workflow to use app permissions feature, then create App Step action where you will place your create project action.
You can find more information on how to add App Step as well as how to setup permissions here:
App step in SharePoint Designer
(MSDN) Create a workflow with elevated permissions by using the SharePoint 2013 Workflow platform
Do you have schedule template associated with your EPT?
if yes, then you have to include that template to that group's category within selected projects section.
Go to the category of that user's group, select the project template and include it into selected projects.
You can find steps and details in this blog by my colleague: http://www.epmpartners.com.au/blog/sharepoint-list-workflow-failing-when-creating-project-from-list-item/
hope this helps.

Is there a way to figure out how often a SharePoint user clicked on a SiteCollection?

I'd like to know if there is a way to figure out how often a SharePoint (2013) user clicked on a SiteCollection or Web. Is there a specific service that is capable of the logging or is there a log in the database anyway? My idea is to display the result as a graph. For example:
(user a)-[40 clicks]->(SiteCollection X)<-[60 clicks]-(user b)
Read this for analytics in Sharepoint
https://technet.microsoft.com/en-us/library/jj219554.aspx
But, if this report is important to you I strongly recommend using something like google analytics (which is free of course) to track the data by your self.
You can create your own account, and send an event each time user enters your site or web.
I did some more research and found the "SharePoint audit log reports". They do almost exactly what I want. Information about how often items in a SiteCollection have been clicked is provided and reports are saved as exel sheets. Example

Sitecore/Dynamics integration user missing in marketing list

We have Sitecore linked to Dynamics using the Sitecore integration module. Within Dymanics we have a marketing list that contains 1000 users and we have successfully added this list as a role to Sitecore.
However when we look at the number of members in the role within Sitecore only 800 of them are showing. Somewhere between dynamics and Sitecore 200 users are going missing. Has anyone seen this before?
The provider:
Only shows the active marketing lists from CRM
Only shows the marketing lists with the Contact member type.
The provider only shows Contacts entities; it shows neither accounts nor leads from CRM.
I have found there are a lot of issues with caching in the Sitecore CRM module.
I don't know if this has anything to do with your specific issue but I am seeing similar behaviour. For example, if I add a marketing list in Dynamics and view the associated users in that role in Sitecore everything is fine but if I were to go ahead and add new contacts to the marketing list in Dynamics then those new users are not reflected in Sitecore until the cache is cleared (My guess is the IsUserInRoleCache).
I think this is a pretty bad flaw since regular marketing users will probably not know to clear the cache or forget even if they have a way of doing so.
What's even worse is that the same situation occurs when working with users in Sitecore. The profile details for a user are not updated until the cache is cleared (UserProfileCache). I found that this can actually lead to data being overwriten in Dynamics when the two-way (Read-Write) connection is enabled between Sitecore and Dynamics. For example, old data may be displayed for a user in Sitecore if the cache was not cleared and then the old data is sent back to Dynamics on save which overwrites the correct data stored in the CRM. I ended up writing some custom code to get around this issue because I did not feel comfortable moving forward with this issue in place.
Hope this helps even if it's not exactly the cause of your issue.

creating web service for querying TFS

I have been tasked with creating a web service(usingVS2010) to query TFS (2010) by the workitem number. The user would access the web service, then type in the workitem number and project name and hit a go button. This would call the web service, retrieve the title, and description and display it for the user on a seperate application. So starting this process I thought I would create a simple console application that does the same thing. I was able to connect to the server and I am able to see the collection of project that exists. What I am looking for is some help in querying the Server so that I can type in a number and get a response in my console. Does anyone have any examples, or direction or websites? While I wait for an answer I will be searching the web. Thanks in advance.
You'll want to use the TFS SDK to query work items programmatically.
Ewald Hoffman has posted an excellent example of how to get a work item by ID:
Part One discusses how to get connected to your server
Part Two shows how to query for a work item by ID.

How can I use SharePoint Web Services to determine if a user has a document checked out?

(Note I need a solution for this that works on 2007 and 2010)
We have a desktop application that we are adding Sharepoint Check in and out functionality to using the Web Services.
One issue we are coming up against is determining if the current user (of the desktop app) has a document checked out.
Our current approach is to get information about the document in question via Lists GetListItems call which will return us the ows_CheckoutUser field if the document is checked out.
We then want to compare the name of the check out user to the name of our user.
The problem is the name in ows_CheckoutUser seems to be the display name of the user and not the account name and therefore is not unique and not reliable for this check.
I noticed that ows_CheckoutUser also returns an ID value for the user but I can't seem to find out how to get the ID of my current user so I can compare on that instead.
Does anyone have any thoughts on this? Is this the right way to go about it or is there a better way?
I have thought about trying to run a query via GetListItems that would match on the document name and the checkout user equals my current user to see if I get any results back but I think that would suffer from the same problem.
Or maybe I need to go outside the Web Services and use the author.dll?
Edit
I've started going down the route of using an RPC call to getDocsMetaInfo via the Author.dll FP extension.
This call actually gives you the account name of the user that has the document checked out.
I'd still be interested in a solution using the Web Services however
Not sure what the native reply of sharepoint but I suppose it should be the same as when using the Camelot .NET Connector for SharePoint.
You have a few fields which possibly can hold this info
CheckedOutUserId, ID of the User who has the item Checked Out (Lookup)
IsCheckedoutToLocal, (Lookup)
CheckoutUser, Checked Out To (User)
CheckedOutTitle, Checked Out To (User) -
LinkCheckedOutTitle, Checked Out To (Computed)
It actually is LinkCheckedOutTitle that contain the visual reference to the user who checked the document out. In my case it's listed as trikksdomain\trikks, or if a localadmin checked the doc out its machine\administrator.
Here is a SharePoint 2010 Document Library Column Reference guide. http://www.bendsoft.com/download.php?id=b05c062a401cf8bc221ea5df63cc9570