User Profile Management - Profile Object Already Exists

This is Interesting: Free IT Magazines  
Home > Archive > User Profile Management > August 2005 > Profile Object Already Exists





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 Profile Object Already Exists
Sam

2005-07-30, 5:49 pm

Hi,

I am trying to create a new address profile using the following code:
------------------------------------------------------
Dim newAddr As Profiles.Profile
Dim newGuid As Guid

If
current.ProfileSystem.GetProfile(userProfile("GeneralInfo.shipping_address").Value, "address") Is Nothing Then

newAddr = current.ProfileSystem.CreateProfile(newGuid.ToString, "address")

End If
-----------------------------------------------

I then receive the following error:
Exception Details: System.Runtime.InteropServices.COMException: Profile
object already exists.


[COMException (0xc100400b): Profile object already exists.
]

Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.CreateProfile(Object sValue, String bstrType) +0
Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
profileService, String keyValue, String profileType, Boolean retrieveProfile)
+77

& #91;CommerceProfileAlreadyExistsExceptio
n: A profile object with conflicting
values for one or more key members already exists.]
Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
profileService, String keyValue, String profileType, Boolean retrieveProfile)
+357

Microsoft.CommerceServer.Runtime.Profiles.ProfileContext.CreateProfile(String
keyValue, String profileType) +170
healthchemist.EditProfile.btnSave_Click(Object sender, EventArgs e) in
C:\Inetpub\commerceroot\healthchemist\Ed
itProfile.aspx.vb:160
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler

sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1262


The error occurs in the following line of code:
current.ProfileSystem.CreateProfile(newGuid.ToString, "address")


Can anyone help me with this problem?

Thanks.
Colin Bowern

2005-08-01, 5:51 pm

Sam,

Are you initializing the newGuid variable properly? Here's some C# that
makes sure it is generated properly:

Guid newId = Guid.NewGuid();
return newId.ToString("B", CultureInfo.InvariantCulture.NumberFormat);

Cheers,
Colin



"Sam" <Sam@discussions.microsoft.com> wrote in message
news:9FCB5E56-76E8-466A-BF7B-DDC1327CF07F@microsoft.com...
> Hi,
>
> I am trying to create a new address profile using the following code:
> ------------------------------------------------------
> Dim newAddr As Profiles.Profile
> Dim newGuid As Guid
>
> If
> current.ProfileSystem.GetProfile(userProfile("GeneralInfo.shipping_address").Value,
> "address") Is Nothing Then
>
> newAddr = current.ProfileSystem.CreateProfile(newGuid.ToString, "address")
>
> End If
> -----------------------------------------------
>
> I then receive the following error:
> Exception Details: System.Runtime.InteropServices.COMException: Profile
> object already exists.
>
>
> [COMException (0xc100400b): Profile object already exists.
> ]
>
> Microsoft.CommerceServer.Interop.Profiles.ProfileServiceClass.CreateProfile(Object
> sValue, String bstrType) +0
> Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
> profileService, String keyValue, String profileType, Boolean
> retrieveProfile)
> +77
>
> & #91;CommerceProfileAlreadyExistsExceptio
n: A profile object with conflicting
> values for one or more key members already exists.]
> Microsoft.CommerceServer.Runtime.Profiles.Profile..ctor(ProfileContext
> profileService, String keyValue, String profileType, Boolean
> retrieveProfile)
> +357
>
> Microsoft.CommerceServer.Runtime.Profiles.ProfileContext.CreateProfile(String
> keyValue, String profileType) +170
> healthchemist.EditProfile.btnSave_Click(Object sender, EventArgs e) in
> C:\Inetpub\commerceroot\healthchemist\Ed
itProfile.aspx.vb:160
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument) +57
> System.Web.UI.Page. RaisePostBackEvent(IPostBackEventHandler

> sourceControl, String eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1262
>
>
> The error occurs in the following line of code:
> current.ProfileSystem.CreateProfile(newGuid.ToString, "address")
>
>
> Can anyone help me with this problem?
>
> Thanks.



Sam

2005-08-06, 2:47 am

What a simple mistake!

Thanks for your help

"Colin Bowern" wrote:

> Sam,
>
> Are you initializing the newGuid variable properly? Here's some C# that
> makes sure it is generated properly:
>
> Guid newId = Guid.NewGuid();
> return newId.ToString("B", CultureInfo.InvariantCulture.NumberFormat);
>
> Cheers,
> Colin
>
>
>
> "Sam" <Sam@discussions.microsoft.com> wrote in message
> news:9FCB5E56-76E8-466A-BF7B-DDC1327CF07F@microsoft.com...
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com