Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DNN SDKDNN SDK
Previous
 
Next
New Post
4/1/2009 9:18 AM
 

 I am wondering if there is a complete, searchable SDK for DNN object model.  I have been doing some integration work between our site and DNN for a few days and have been using various online help sources to figure stuff out.  If there is a complete SDK somewhere, I would love to have it so I have a one stop research center for the DNN object model.  

Specifically, right now, I am trying to create a new user programmatically.  I instantiated a new UserInfo object and set its properties such as username, pwd, firstname, lastname, etc, and then called the "CreateUser" shared function from the UserController class, which gave me an "Unexpected Error" status, but also created the user in DNN.  What's interesting is that when I log in as a host in DNN, I can see the user under host accounts, but I can't work with this user in any way.  When I try to edit this user, DNN says this user doesn't exist.  I can't even delete this user now.  Not sure what's going on here, so any help would be greatly appreciated.  Also, if someone can point me to a one stop shop for SDK and some code examples, that would be wonderful!

Thanks!

 
New Post
4/1/2009 10:23 AM
 

please see http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/2154/MSDN-Style-help-files-for-DNN-5-0-0.aspx for a CHM of API functions. Regarding the usercreate function, you should make sure you validate the status of creation e.g.

 

Dim createStatus As UserCreateStatus = UserController.CreateUser(objUser)If createStatus = UserCreateStatus.Success Then

newuserID = objUser.UserID

 

Else

strMessage += UserController.GetUserCreateStatus(createStatus)

 

End If

 


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
4/1/2009 11:07 AM
 

Thanks a lot for your reponse!!  The SDK will certainly be extremely useful.  

For the CreateUser problem I described above ... I had done exactly what you are saying.  As I mentioned, the UserCreateStatus is "UnexpectedError"  but it still creates the user.  I can see this use under my host accounts but can't delete or edit this user - DNN says this user does not exist!

Do you have any additional insight?  Is there some sort of exception log or stack trace I can refer to when something like this happens?

Thanks in advance!

 
New Post
4/1/2009 12:34 PM
 

unfortuantely no. If you look at \Library\Providers\MembershipProviders\AspNetMembershipProvider\AspNetMembershipProvider.vb in the CreateUser function you'll see that that status is the catch in the try block, and only the status is returned, the exception itself is "swallowed" (which is wrong IMO, both should happen). I'd suggest you debug that section of code to work out what's causing your problem. As for the the user, it would seem that likely that the CreateMembershipUser function worked, adding a user entry to the aspnet_ table(s), and then the CreateDnnUser function failed (so the user isn't in the User's table, hence why dnn can't "see" the user). If this is the case it would be safe to delete the partial entry in the aspnet_* table(s) (please backup first)

Cathal


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
4/1/2009 4:38 PM
 

Before, I was creating a stand-alone web service in my DNN solution (rather than extending the WebService class in DNN).   I thought maybe that was the reason it was not working, so I tried extending the WebService class instead, but for the same results.

I was also NOT setting the PortalID property on the user because I didn't know how to get to the PortalID in my CreateUser method.  Then I came across the DNN core CreateUser method provided with the standard web services that come with the IWeb module install.  This method was using the IWebCredentials property to get the portal ID to assign it to the new user (which is the only difference in my code and the core DNN code).  Now, the problem is that it is complaining about IWebUserCredentials property being unreferenced.  In other words, the IWebUserCredentials is NOTHING.  

Here's my new function ...  can someone spot where I am doing something wrong?

        Public Function MyCreateUserMethod(ByVal sUserName As String, ByVal sPWD As String, ByVal sEmail As String) As String

            Dim oUser As New DotNetNuke.Entities.Users.UserInfo

            Dim oStatus As DotNetNuke.Security.Membership.UserCreateStatus

            Try

                oUser.PortalID = IWebCredentials.PortalID

                oUser.Membership.Username = sUserName

                oUser.Username = sUserName

                oUser.DisplayName = sUserName

 

                oUser.Membership.Password = sPWD

                oUser.Membership.Approved = True

 

                oUser.Membership.Email = sEmail

                oUser.Email = sEmail

                oUser.Profile.FirstName = "User"

                oUser.Profile.LastName = "Creation Test"

 

                oStatus = DotNetNuke.Entities.Users.UserController.CreateUser(oUser)

                DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(oUser)

                If oStatus = DotNetNuke.Security.Membership.UserCreateStatus.Success Then

                    Return oUser.Username

                Else

                    Return String.format("Error: {0}", oStatus.ToString)

                End If

            Catch ex As Exception

                Return String.format("Exception: {0}", ex.Message)

            End Try

        End Function

 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DNN SDKDNN SDK


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out