Infopath form locked but not checked out - sharepoint

I am storing Infopath forms in a Sharepoint Document Library.
Because these forms are completed in a disconnected environment, the document library is used for storing the submitted forms (and other related documents). A web application also updates the Infopath documents.
The Infopath Template associated with the forms is installed on user's PCs as an msi.
I've noticed that if a user has one of the forms open from the document library (but not checked out),using the Copy web service to update the document returns a "DestinationCheckedOut" error. My question is, is there anything I can use to query Sharepoint to determine if a user has the file opened. I've used Lists web service and CheckoutUser but this only worked if document is checked out (not just open). I've also tried setting "Version Settings" to "Require documents to be checked out when edited" but doing so returns the error "Infopath cannot open the following file:.....The file is not a valid XML File" when the form by opened by a user.
I am going to handle the "DestinationCheckedOut" exception but wanted to have my code check for this scenario first before the update process is attempted.
Any help would be appreciated.

I don't know if there is any Web service that return the information you are looking for.
The server side object model calls are SPFile.CheckOutStatus and SPFile.CheckOutType ( http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile_properties.aspx ). There are 2 types of "checked out" one when document is simply opened for editing and the other when it is explicitly checked out - you hitting the first one.

Related

Email Attachments to SharePoint Document Library - Error

I have this weird problem when I try to use a simple default flow template to save email attachments to the company main SharePoint site: company.sharepoint.com (not subsite).
So I get started, by taking all the defaults of this flow, however, once i get to the point of providing the site address and document library path I get the error highlighted in red.
Where I get confused is that when I create a subsite like company.sharepoint.com/sites/testsite I enter the subsite address and the folder path automatically populates the folder structure for me to pick where I want to save such attachment.
I have given full owner permission to this test account with same results. So permission is not the problem.
My question is, could it be I'm using the wrong flow to save to a main SharePoint site? or this is something not allowed?
You could check the connector and recreate a new connection to SharePoint.
In many cases, an error code of 403 appears in a flow fail because of an authentication error. If you have this type of error, you can usually fix an authentication error by updating the connection, please make sure you have update the connection.
You could refer to this article.
Just in case anyone has a similar problem, the account to which you are creating a power automate flow must be a site collector to the root SharePoint site.

Excel Hyperlink adding redirectURL

I'm creating a hyperlink in excel
=HYPERLINK("https://www.redacted.com/index.html?Display=GroupMeetings/index","link")
When I click on this link it changes the Url to
https://www.redacted.com/index.html?redirectURL=Display%3DGroupMeetings%2Findex
if I change the URL to have ?Displayy= with two y's it does not add the redirectURL attribute. I cannot find any documentation about why this is added. Anyone know why?
The end goal is to deep launch users to specific pages within the application via a hyperlink in excel.
Do the users need to be authenticated to view the pages you are sending them to?
If so the cause may be this (taken from this answer on super user https://superuser.com/a/445431/154198):
Clicking a URL in Excel seems to open it in your default browser. But that's not really true. Before opening it in your browser, Excel first runs Microsoft Office Protocol Discovery. This uses a Windows/Internet Explorer component to determine if the URL works. (It does not identify itself as Internet Explorer, but as "User Agent: Microsoft Office Existence Discovery".) And if the results are (somehow) okay then it will open the result of that check in your default browser.
Microsoft have issued a fix for this KB218153 - which can be found here:https://support.microsoft.com/en-gb/help/218153/error-message-when-clicking-hyperlink-in-office-cannot-locate-the-inte
This may not be your specific problem, but it is at least worth knowing about.

Is it possible to autocomplete fields in Sharepoint with user info?

I'm in charge of a Sharepoint collection, and a user asks this. Is it possible that when a user creates an item, some fields are automatically filled with some info, such as email address and location?
Authentication uses Active Directory, so every user is identified when using Sharepoint. The only issue is that, being in a big corporate company, I don't have any access to the server, so it must be feasible through configuration of said site/list or using Sharepoint Designer, but I can't and won't be allowed to deploy anything server side.
Any idea?
With your limitations, your best bet would be a combination of ajax (I suggest jquery) and sharepoint webservices (if necessary), you need to do a XmlHttpRequest in the userdisp.aspx page, if this page has all the info you need, then get it, otherwise, get the currently logged account and use it to query the webservices (this part I'm not sure if theres a method that will return this info).
This all works using only the browser (Content Editor WebPart) or the SharePoint Designer client.

Temporary Internet File (read from SharePoint via IE). How do I find the URL?

When an IE user clicks the link of a file residing in SharePoint (and user selects "read-only" access), the file is copied to Temporary Internet Files, my application is opened and passed that filename as a parameter. I'm trying to implement a "check out" button in my app so that a user can switch from read-only mode to check-out and edit mode. I haven't been able to find a way to learn the SharePoint URL for the file. On check-out and edit, it's no problem: there's a registry entry that maps the file on my system to the URL in SharePoint; I haven't found anything like that for read-only files.
EDIT:
There is a URL column available in Windows Explorer, but when I display that column (in Explorer), all the values are blank. Also, I can't find any file information api call that will return this value for me.
UPDATE:
I found some promising calls in the wininet.lib: FindFirstUrlCacheEntryEx (and "next") along with FindFirstUrlCacheGroup (and next). They didn't seem to return any data, and from what I read, these only return my application's use of the wininet api calls cache -- not I.E.'s.
I also tried running through the list of COM calls that IE made into my app when the file was opened to see what interfaces it was seeing if I supported. One that looked promising was the IMonikerProp interface, which, when I implemented it, did get called... however it only provided me with the mime type property, the classid of my app and the TrustedDownload flag.
Maybe this site has the answer: How SharePoint communicates with Word via ActiveX
Another option could be to hook into the SharePoint ItemCheckingOut event. Example 1 Example 2 . In the event you could get the URL info and create some temporary file with the info or pass the info off to your program.
Link to ActiveX control info - Maybe this control is launched on everything? You might be able to tap into that.
Does the temporary file created have a good name (does it match what the file is actually called or is it gibberish). If it's a good name, you can probably search for it. Otherwise, without knowing the site, folder, filename, you might not be able to unless there is some additional data about the file somewhere.

How can I validate within an InfoPath form whether a user exists within a SharePoint Portal?

I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person.
How can I validate whether this Person exists or not?
Instead of validating the user, is there a way to fill a dropdown List with all usernames of the portal? (which of cause would be users from the Active Directory)
I haven't done this specifically, so there may be a better way, but I've been pulling a lot of data out of SharePoint and into an InfoPath Form (deployed to a SharePoint forms library and accessible through SharePoint Forms Service with MOSS Enterprise) and also going the other way using the SharePoint web services - very quick to use, and the person web service is right there.
Have you tried looking at the Contact Selector (an ActiveX control). Here is a MSDN-article describing how to add it as a control in InfoPath and this one describes how to make it work.
I have been using it in the majority of my infopath projects and it works flawlessly - also for browser-enabled forms.
When doing something similar in an ASP.NET application, I've used the Sharepoint search and searched the "People" Scope for the specific user. You can also search across profile information so you can pull back everyone with a certain Job Title, or in a specific Department.
I don't validate a person's existance, but I do determine a person's full name using their login and SharePoint. You should be able to modify this code for your purposes, it is below. For it to function you need a data connection in your InfoPath document called GetUsersFromSP. Configured as follows:
Location is - http://njintranet2/_vti_bin/usergroup.asmx?WSDL
Operation is – GetUserColectionFromSite (last one on list)
Automatically retrieve data when form is opened should be checked.
string ADName = System.Environment.UserName;
IXMLDOMDocument3 UserQuery = (IXMLDOMDocument3)thisXDocument.GetDOM("GetUsersFromSP");
UserQuery.setProperty("SelectionNamespaces",
"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" " +
"xmlns:tns=\"http://schemas.microsoft.com/sharepoint/soap/directory/\"");
((WebServiceAdapterObject)thisXDocument.DataAdapters["GetUsersFromSP"]).Query();
IXMLDOMNode Users = UserQuery.selectSingleNode("//dfs:myFields/dfs:dataFields/tns:GetUserCollectionFromSiteResponse/tns:GetUserCollectionFromSiteResult/tns:GetUserCollectionFromSite/tns:Users");
foreach (IXMLDOMNode current in Users.selectNodes("tns:User"))
{
string Login = current.attributes.getNamedItem("LoginName").text;
Login = Login.ToUpper();
if (Login.EndsWith(ADName.ToUpper()))
{
thisXDocument.DOM.selectSingleNode("my:root/my:config/my:User").text = current.attributes.getNamedItem("Name").text;
break;
}
}
Use this control:
http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx
Or if you want to build your own validator, you'll need to query the SharePoint profile database. I'd recommend this over querying AD directly. There's lots of articles online about working with the profile database.
Have a look at this Link, it explains how to populate a dropdown with the SharePoint Users
http://blueinfopath.blogspot.com/2008/10/how-to-populate-list-with-sharepoint.html
I you want to validate,
- Make a textbox
- Add a Button, name it ValidateUser
- Create a Receive Connection to the ......
- Att Rules to the ValidateUser
- Add the textbox to the field AccountName in the Secondary Datasource
- Execute the receive connection
- Get the value of the field Value with filter Name="PreferredName"
This work for Infopath Form Services
Test it and enter the UserLogin into the textbox and click on the Validate Button
Frederik

Resources