User Profile Management - creating user profile in the loop

This is Interesting: Free IT Magazines  
Home > Archive > User Profile Management > October 2006 > creating user profile in the loop





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author creating user profile in the loop
JC

2006-09-29, 7:48 pm

Hi,

I had to create a procedure, which loops thru list of users and create a
profile for each of them. Also I am assigning addresses to those users.
Everything goes fine and profile gets created with unique GUID but when I am
trying to assign address the Address object gets created for the first
created profile – it creates an address with g_id = first created GUID.
I also mentioned that UserObject..CurrentUser.UserID doesn’t change as well.
What should I do in order to assign Address object to the latest created
profile?

Thanks for any help

David Hargis [MSFT]

2006-10-13, 7:33 pm


I'm not certain that I completely understand what you are doing, but you
specify the ID of the Address when you call the CreateProfile API. You can
then link the UserObject profile to the Address profile by setting the
GeneralInfo.address_list property of the UserObject

I imagine the code in your loop would be something like

----------------------------------------
Guid userId = Guid.NewGuid();
Profile userProfile =
CommerceContext.Current.ProfileSystem.CreateProfile(userId.ToString("B"),
"UserObject");
...
Guid addressId = Guid.NewGuid();
Profile addressProfile =
CommerceContext.Current.ProfileSystem.CreateProfile(addressId.ToString("B"),
"Address");
...
addressProfile.Update();

object[] addressList = new object[1];
addressList[0] = addressId.ToString("B");
userProfile["GeneralInfo.address_list"].Value = addressList;

userProfile.Update():
----------------------------------------

Hope this helps,
David

--------------------
Thread-Topic: creating user profile in the loop
thread-index: AcbkD/WcwgSKeSAqRLGQiqlbVtdaCw==
X-WBNR-Posting-Host: 209.53.189.3
From: =?Utf-8?B?SkM=?= <JC@discussions.microsoft.com>
Subject: creating user profile in the loop
Date: Fri, 29 Sep 2006 14:41:02 -0700
Lines: 13
Message-ID: <6C399969-763B-42E0-A3D3-00D610980A4E@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.commerceserver.userprofilemgt
Path: TK2MSFTNGXA01.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.commerceserver.userprofilemgt:3659
NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.commerceserver.userprofilemgt

Hi,

I had to create a procedure, which loops thru list of users and create a
profile for each of them. Also I am assigning addresses to those users.
Everything goes fine and profile gets created with unique GUID but when I
am
trying to assign address the Address object gets created for the first
created profile â€" it creates an address with g_id = first created GUID.
I also mentioned that UserObject..CurrentUser.UserID doesn’t change as
well.
What should I do in order to assign Address object to the latest created
profile?

Thanks for any help




--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com