Closed hemalmoss closed 10 years ago
Do you see any errors on the console?
Also, I want to make sure I understand what a going on. Is this it:
Also, Can you post your code, so I can get a better idea how you are using it.
Yes your understanding is correct except the 4th point. if in the step 1 i selected the users first name then in the suggesation i get his full name then when i pick a user from the list of suggestion then in the textbox first name gets replaced with full name.
I have not made any changes in the demo page (Demo.SPWidgets.aspx). This happens only for a user that is selected first time not later.
No i dont see any error.
Ahh. Ok... Good to know you are using the demo page. On that page, can you let me know what version you are running (click on the last tab - far right -with the exclamation point icon). Also, What version of SharePoint are you running this on?
Below are the version details. I am running it on SharePoint 2010. •SPWidgets: 20130907113411 •jQuery: 1.10.2 •jQueryUI: 1.10.2 •jQueryUICss: loaded •SPServices: 0.7.2
Can you try the latest demo file. I remember fixing a few issues with people picker that will be in the next version. You can download the file from here: https://github.com/purtuga/SPWidgets/tree/master/demo
I just tried it on O365 and it worked.
The issue is still there even with the new demo file.
The issue is not happening with all the users but only for some users and that also once i refresh that issue does not occur for that user again.
not sure why this is happening may be some userprofile sync issue in the environment. Is there some particular area where i can put breakpoint and try to debug what is happening. I think this issue might be specific to our environments.
The first thing I would look at is the ajax request (to the SearchPrincipals service) to see how the trouble entries differ from the others. Not sure how a refresh fixes it. If the data is returned on the initial query, then the widget should be able to use it - unless something is not right with the response data (or at least in the expected format.
I'm not at a computer right now, but I don't think that placing a breakpoint is going to work - I think I'm using the minimized version of the library in the demo page.
Today I tried the demo page on SP2010 (on premises) as well as SP2007 and it worked. I also checked the source of the aspx page and like I stated: placing a breakpoint there is not going to help - it has the minimized version of the library. I hope you find the issue within your environment.
I tried lot of things but no luck. I have now created a webpart that uses this and have referenced the SPwidgets.js (for debugging as it is not a minimized version) so if you can think of something that cause be causing issue, it may help. In the normal senario 1) user types characters in the text box 2) /_vti_bin/People.asmx is called 3) on selection of a user from the list /_vti_bin/client.svc/ProcessQuery is called 4) /_vti_bin/client.svc/ProcessQuery is called for all the users selected.
In problematic senario the point Process Query is not at all called.
Ok. You got other things going on here. The widget does not use the sp2010 new API (client.svc), so that must be your code.
Can you post your code that calls the people picker? That might give me a better idea what you are trying to do. I will the also be able to suggest some alert()'s to reveal more data.
Hi, Please find attached.
One more observation is that if i get one user with id of -1 e.g 2;#Preethi Chandramouli;#56;#Abou Antoun, Rana;#-1;#Acharya, Gaurav where Acharya, Gaurav has an id of -1 then later if i add another user who also has an id of -1 then the problem is there.
-1 id is coming for all the users who were never added into the site earlier. If you see my code i hade to make modifications and have to call ensureuser to add them before i submit as otherwise i used to get message that the user is not unique.
so what i want to know is where all you have put the condition of checking that the user is already there based upon id .e.g i found this position
$.pt.pickSPUser.storeListOfUsers
Is it possible we can do a quick net meeting. I know i am asking a lot but need your help.
On Thu, Jun 5, 2014 at 5:37 PM, Paul T. notifications@github.com wrote:
Ok. You got other things going on here. The widget does not use the sp2010 new API (client.svc), so that must be your code.
Can you post your code that calls the people picker? That might give me a better idea what you are trying to do. I will the also be able to suggest some alert()'s to reveal more data.
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45278382.
Hi, I found out the issue in the code. The problem is in the line no 5099 where you are checking if the user already exist based upon the display id. But there can be several occurances where the display id will be same in case of -1 so this cannot work. I have modifed copy of code as below and using the pickspusername. This solved the problem. In general it seems that you have not considered the senario when the user id returns -1 and so problem occurs.
// Check if already displayed.
} else if (
o.eleSelected.find(
"div[data-pickspusername='" +
u.item.displayName + "']" ).length
) {
alert("You have already selected this user");
return;
}
Can you please help me to understand what does the below line of code do in $.pt.pickSPUser.storeListOfUsers
if (isDone[$(this).attr("data-pickSPUserID")]) {return;};
isDone[$(this).attr("data-pickSPUserID")] = true;
Thanks for the investigation. You are correct that the widget does not account for the fact that users can have the same ID. What is a user that has an ID of -1? What does it mean? Regarding the iDone object: it just keeps track if the user is already selected. There is no point in adding the user to the selected list if they are already there. I guess a quick fix would be to change that check to only be done if the ID is NOT -1. Else, do the check. The check will probably need to be a little more involved to ensure we don't add the same user more than once.
I'm on my phone right now, so a little hard to really review the code. I'll look at this tomorrow or over the weekend. And yes, I can join you on a meeting if needed.
Paul T.
-- Sent from Mobile
Could you give me more information about "-1 id is coming for all the users who were never added into the site"
I want to fix this, but would like to first try to recreated it. Do you know where I can find more information about this condition. Thanks for your help.
I get -1 for new users. Once i call ensureuser an id is assigned to that user and henceforth always get that users id.
On Friday, June 6, 2014, Paul T. notifications@github.com wrote:
Could you give me more information about "-1 id is coming for all the users who were never added into the site"
I want to fix this, but would like to first try to recreated it. Do you know where I can find more information about this condition. Thanks for your help.
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45390848.
Got it. I found out more information about the -1 here: http://stackoverflow.com/questions/13166738/sharepoint-people-asmx-web-service-returns-1
Are you working on now? Or still need a quick patch to allow the people picker to select multie users with the same ID?
This is a bug which I will be fixing soon. The solution I think will be to resolve the user (same as ensureuser) when they are selected. There is a webservice for that as well, as the post in the link above reveals.
Currently i have made some fix at my end. Not very neat but will work for now.
On Friday, June 6, 2014, Paul T. notifications@github.com wrote:
Got it. I found out more information about the -1 here: http://stackoverflow.com/questions/13166738/sharepoint-people-asmx-web-service-returns-1
Are you working on now? Or still need a quick patch to allow the people picker to select multie users with the same ID?
This is a bug which I will be fixing soon. The solution I think will be to resolve the user (same as ensureuser) when they are selected. There is a webservice for that as well, as the post in the link above reveals.
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45391813.
Ok. Good. I'll post back soon with a solution. Maybe you can try it for me.
One last request... Any chance you can email me the XML response from the People server (SearchPrincipals), which shows the users with -1? You can email it directly to me, if you prefer not to post it here, at paultavares1 [at sign] gmail [dot] com.
Just send you on your email.
On Fri, Jun 6, 2014 at 7:11 PM, Paul T. notifications@github.com wrote:
One last request... Any chance you can email me the XML response from the People server (SearchPrincipals), which shows the users with -1? You can email it directly to me, if you prefer not to post it here, at paultavares1 [at sign] gmail [dot] com.
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45392918.
I did not get your email, but after reviewing the code, I have an idea of how to protect it against this condition. it a bit trickier than what I was thinking...
Can you try this patched version to see if it works?
https://gist.github.com/purtuga/0643682595685d97c3fd
The fix is not complete... specifically, the add/remove methods that the widget supports need to be changed to account for this condition (where the ID is not unique).
Note also that this version is the latest and has some work underway for the Filter panel widget... so if you are using that widget as well, it may not be stable. If you are only using the People picker, then it should be fairly safe...
Let me know if it works in selecting the users with -1 ids.
Another Questions: What happens when you do this
web.ensureUser(userName);
Does the user get automatically added to a site group? which one?
Paul.
how do i make this work. I downloaded this JS file and replaced it with SPwidjets.js but does not seem to be working. Instead i see the entire javascipt as text.
Can you create the test page and i can test that way.
On Tue, Jun 10, 2014 at 6:19 PM, Paul T. notifications@github.com wrote:
Can you try this patched version to see if it works?
https://gist.github.com/purtuga/0643682595685d97c3fd
The fix is not complete... specifically, the add/remove methods that the widget supports need to be changed to account for this condition (where the ID is not unique).
Note also that this version is the latest and has some work underway for the Filter panel widget... so if you are using that widget as well, it may not be stable. If you are only using the People picker, then it should be fairly safe...
Let me know if it works in selecting the users with -1 ids.
Another Questions: What happens when you do this
web.ensureUser(userName);
Does the user get automatically added to a site group? which one?
Paul.
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45679499.
Sounds like you did not download it correctly... Try this... Right click this link below and do a "Save as..." https://gist.githubusercontent.com/purtuga/0643682595685d97c3fd/raw/7ab67e9abe382a6b78dd31a7ea0f2e1111441d56/jquery.SPWidgets.patch.js
Save it to your computer and then replace your SPWidget.js file with this new one.
if that still does not work - Open up your local file in a text editor... copy the file content from the link above and paste it into your local file (replacing what was there before).
Hi, It works but not completely, i think you need to still work on this. Now it allows the same user to select multiple time and also the id first time was -1 but later got the id as 3411.
Also since the user id is -1 while submitting i get error as the user is not unique or does not exist.
I think you might have called the ensure user at wrong place.
-1;#Appelt, Mike;#-1;#Geroldi, Roberto (Ext);#-1;#Tikhanovskiy, Alexander (Ext);#3511;#Appelt, Mike
On Wed, Jun 11, 2014 at 1:00 PM, Paul T. notifications@github.com wrote:
Sounds like you did not download it correctly... Try this... Right click this link below and do a "Save as..."
Save it to your computer and then replace your SPWidget.js file with this new one.
if that still does not work - Open up your local file in a text editor... copy the file content from the link above and paste it into your local file (replacing what was there before).
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45769509.
I'm not calling 'ensureUser' because I don't realy know what it does. In all the documentation I have read it says it adds the user to the site. But what does that mean? Does it adds it to a specific group within the site? Do you know? What happens when you ensureuser?
Paul T.
-- Sent from Mobile
Not 100% sure but it adds user into the hidden users list. Then i dont understand why same user gets 2 different id. Once -1 and then some number.
On Thursday, June 12, 2014, Paul T. notifications@github.com wrote:
I'm not calling 'ensureUser' because I don't realy know what it does. In all the documentation I have read it says it adds the user to the site. But what does that mean? Does it adds it to a specific group within the site? Do you know? What happens when you ensureuser?
Paul T.
-- Sent from Mobile
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45965928.
That's what I'm struggling with. I'm going to have to find a place where I can test this out to see what realy happens. I don't want to change the widget to automatically call ensureuser if that has some kind of negative affect.
Paul T.
-- Sent from Mobile
Oh.. So you dont have an environment with AD set up. Then it is going to be tricky
On Thursday, June 12, 2014, Paul T. notifications@github.com wrote:
That's what I'm struggling with. I'm going to have to find a place where I can test this out to see what realy happens. I don't want to change the widget to automatically call ensureuser if that has some kind of negative affect.
Paul T.
-- Sent from Mobile
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45966340.
I have a O365 setup, but it does not have the issue. I'll have to find another way. If you could test, that would be great. Just select a user with a -1 ID. Validate that they are not in the site'a groups (owners, visitors, members). Then do ensureuser on them and check the groups again. I'm hopping all it does is add to the internal users table.
Paul T.
-- Sent from Mobile
I checked that. It just adds users into the hidden user information list. It does not add users into any group.
On Thursday, June 12, 2014, Paul T. notifications@github.com wrote:
I have a O365 setup, but it does not have the issue. I'll have to find another way. If you could test, that would be great. Just select a user with a -1 ID. Validate that they are not in the site'a groups (owners, visitors, members). Then do ensureuser on them and check the groups again. I'm hopping all it does is add to the internal users table.
Paul T.
-- Sent from Mobile
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45966661.
Ok. I just foun a post that described the same thing: http://geekswithblogs.net/juanlarios/archive/2009/11/30/spweb.ensureuser-before-granting-site-access.aspx
So I'm thinking the following: if I see -1 as the ID, I will resolve the user (ensureuser) automatically. So in the end, all users selected by the people picker should be good to add to list columns. I'll see if I can work on this over the weekend.
Paul T.
-- Sent from Mobile
I have done the samething and not using your hidden value.
On Thursday, June 12, 2014, Paul T. notifications@github.com wrote:
Ok. I just foun a post that described the same thing:
So I'm thinking the following: if I see -1 as the ID, I will resolve the user (ensureuser) automatically. So in the end, all users selected by the people picker should be good to add to list columns. I'll see if I can work on this over the weekend.
Paul T.
-- Sent from Mobile
— Reply to this email directly or view it on GitHub https://github.com/purtuga/SPWidgets/issues/21#issuecomment-45967339.
Ok... I think I have a solution... It tested ok on Office365, but need you to test... Please :-)
Updated library here: https://gist.githubusercontent.com/purtuga/0643682595685d97c3fd/raw/d9d684867851425ee96a2468e035a879847799ed/jquery.SPWidgets.patch.js
The solution I implemented was to resolve the principal (ensureuser in >=SP2010) only when a user is selected, so you should always get a good ID when they are added to the hidden input. This behavior can be controlled via a new input parameter (resolvePrincipals), case that is not the desired action in your case: it is, so you don't have to do anything... the default is true .
Can you try and let me know if it works?
Thanks.
Hi, I am trying to use the pickSPUser Widget but it is giving me issue when I select some user. for such users onPickUser function is not getting fired and the selected users stays into the input text box rather then going up with other users names.
Those users then later works fine after first time. (i.e. lets say i have a user abc for whom i face issue, then if i refresh the page and then again select abc then it works fine but not for the first time).
I was able to reproduce this in the demo page present in the solution also.
Please help me in resolving this issue. I propose to use this and now it does not work correctly.