Skip to main content

Power Automate: SharePoint Copy file action fails on file names with a plus (+) sign

Application was unable to connect to the external server

One of our customers approached us with the following issue they had with the Field Service app provided by Microsoft’s Store.
clip_image001
The customer has an on-premise CRM installation. Therefore the app is required to access the CRM server via ADFS in the company’s local area network.
The simplified architecture looks equal to this one:
clip_image001[5]
After some time of investigation I was able to repreduce this issue with the native Resco Mobile CRM app installed via Microsoft Store with Windows 10 as well.
Whenever the machine had an internet connection the app worked just fine, but as soon as the app was launched in a local area network only without any internet connection, the app complained with the error box shown above.
Second step was to use Fiddler tracing as described here:
https://www.resco.net/fiddler-trace/
With an active internet connection I found appropriate Fiddler logs with connection requests. Interestingly, without internet connection I could not find any requests at all.
This gave me the right pointer that this is a application driven behavior and that the issue must be in the coding.
I opened a ticket with Resco support and they kindly provided me the method they use to identify an active connection in their UWP (Universal Windows Plattform) app as well as in their desktop app.
The suspicious method is:
NetworkInterface.GetIsNetworkAvailable()
https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable(v=vs.110).aspx
Now I created two test apps, one UPW app and one regular Windows console app in Visual Studio.
I used GetIsNetworkAvailable() method in both apps and cut off any active internet connection from my test environment. Then I tried to connect to a locally hosted CRM server in our local area network.
The UWP app threw a similar exception as above whereas the console app was fully satisfied with the LAN connection.
I analysed the implementation of the GetIsNetworkAvailable method of the Universal Windows Apps.
Decompiling the System.Net.Networking.dll I found this implementation:
clip_image002
The Enum NetworkConnectivityLevel also contains „LocalAccess“.
https://docs.microsoft.com/en-us/uwp/api/windows.networking.connectivity.networkconnectivitylevel
This means in the world of UW Windows (Store) apps at this point the method GetIsNetworkAvailable() is not usable within a restricted company network.
This will make both your Resco Mobil CRM and also the MS Field Service app not usable in a company network that has the status „LocalAccess“.
Now that I knew the reason behind this problem I was able to provide the customer with a workaround described in these blogs:
https://blogs.msdn.microsoft.com/canberrapfe/2012/10/09/fake-internet-connectivity-for-your-lab-tricking-ncsi/
https://www.chrisebner.de/microsoft/windows-allgemein/network-connectivity-status-indicator-ncsi/
The customer installed a local NCSI server and pointed the desktop PC via changed registry entries to this new server which at the end made the machine think it has an active internet connection.
With that the Field Service app was usable now.
Parallel to this workaround Resco was so nice to accept my code-based workaround that they later had implemented in their UWP code base to deal with LAN networks in a better way which also enables the app to work in LAN networks:
    ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();
    NetworkConnectivityLevel connection = InternetConnectionProfile.GetNetworkConnectivityLevel();
     switch (connection)
     {
          case NetworkConnectivityLevel.None:
                // return has no connection
          case NetworkConnectivityLevel.LocalAccess:
          case NetworkConnectivityLevel.ConstrainedInternetAccess:
          case NetworkConnectivityLevel.InternetAccess :
                // return has a connection
     }
Since Resco Mobile CRM version 11.0.1.0 this problem is gone and was able to verify this successfully with my customer.

Comments

Popular posts from this blog

Yet Another Address Autocomplete PCF Control–powered by Bing

In this blog post I will not go into detail in how to install all the pre-requisites that are required to build and run PCF controls. My goal was to build a new PCF control and get into coding of PCF controls as fast as possible. Here are a few links to articles that will help you installing the pre-requisites (Microsoft PowerApps CLI)  https://docs.microsoft.com/en-us/powerapps/developer/component-framework/get-powerapps-cli Other good references to get into this topic: https://toddbaginski.com/blog/how-to-create-a-powerapps-pcf-control/ https://docs.microsoft.com/en-us/powerapps/developer/component-framework/create-custom-controls-using-pcf I looked through the Guido Preite’s https://pcf.gallery/ which will help you find appropriate use cases / examples for your own needs. It did not take very long to find a simple example to start with: Andrew Butenko's https://pcf.gallery/address-autocomplete/ A few moments later I had the idea to create yet another address autocomplete

Regarding SPFieldMultiLineText (Add HTML/URL content to a field) programmatically

I recently tried so set some HTML content in a SharePoint list column of type SPFieldMultiLineText. My first approach was this piece of code: SPFieldMultiLineText field = item.Fields.GetFieldByInternalName( "Associated Documents" ) as SPFieldMultiLineText; StringBuilder docList = new StringBuilder(); docList.Append( " " ); foreach (DataRow docRow in addDocs) { DataRow[] parent = dr.Table.DataSet.Tables[0].Select( "DOK_ID=" + docRow[ "DOK_MGD_ID" ].ToString()); if (parent != null && parent.Length > 0) { docList.AppendFormat( " {1} " , parent[0][ "FilePath" ].ToString(), parent[0][ "Title" ].ToString()); } } if (docList.Length > 0) { // remove trailing tag docList.Remove(docList.Length-5, 5); } docList.Append( " " ); string newValue = docList.ToString(); item[field.Title] = newValue; What this code does is to get all associated documents to the main document and to add these docu

CRM 2016: The attribute with AttributeId = 'guid' was not found in the MetadataCache.

During the export of an unmanged solution I always received the following error message from my CRM 2016 SP1 OnPremise development system: The attribute with AttributeId = '023bda49-9dfa-401e-b348-9374a4141186' was not found in the MetadataCache. Then I tried to remember what I did since the last solution version. => Yes, there was a field that I deleted, because the customer does not need it anymore. Because I am working on-premise it was easy to check the database for the specific attribute. First, I searched in the attribute table: SELECT [AttributeId]   FROM [Dev_MSCRM].[MetadataSchema].[Attribute]   where [AttributeId] = '023bda49-9dfa-401e-b348-9374a4141186' => result was nothing I concluded CRM deleted the field in this table but missed to remove the attribute from our customer solution. Next thing was to check the solutioncomponent table: SELECT [ModifiedOn]       ,[CreatedBy]       ,[ObjectId]       ,[IsMetadata]       ,[ModifiedBy