RE: SharePoint



Thanks.

Here is the code that I am getting errors on (I x'd out the account name and
site). This was just added to a default new web site. Added Label1 and set
windows authentication to deny any unauthorized users.

Imports Microsoft.SharePoint.Administration
Imports Microsoft.Office.Server.UserProfiles
Imports Microsoft.SharePoint
Imports Microsoft.Office.Server

Partial Class _Default
Inherits System.Web.UI.Page

Dim strSPSite As String = "http://xxxxxxxxx";
Dim accountName As String = "xxxxxx"
Dim mmReturnMessage As String = String.Empty
Dim strSPKey As String = String.Empty

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Try
Using site As New SPSite(strSPSite)

Dim context As ServerContext = ServerContext.GetContext(site)
Dim profileManager As New UserProfileManager(context)

If Not profileManager.UserExists(accountName) Then
Dim profile As UserProfile =
profileManager.CreateUserProfile(accountName)
If profile Is Nothing Then
mmReturnMessage = mmReturnMessage & "Failed to
Create User with account :" & accountName & "<br />"
Else

End If
End If
End Using

Catch ex As Exception
mmReturnMessage = mmReturnMessage & ex.Message
End Try

Me.Label1.Text = mmReturnMessage

End Sub
End Class




""Steven Cheng"" wrote:

Thanks for the reply Gerhard,

Generally we do not have the permission to access product source code
directly and we'll also use the public product symbols is some production
debugging is required. I'll build a web application to see the behavior.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

--------------------
Subject: RE: SharePoint
Date: Thu, 11 Jun 2009 12:04:01 -0700


Thanks.

I built a default Visual Studio 2008 web page, put the routine in it and
called it from the page load event, and got errors.

I even tried setting the application pool to the same one used by
sharepoint
for the web service. Didn't help.

Do you have access to the web service code to see how it is done there?

Thanks again.

""Steven Cheng"" wrote:

Thanks for your reply Gerhard,

Since my original test is also console specific, I may need to test the
web
application case also. I'll let you know if I get any results.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx




--------------------
Thread-Topic: SharePoint
thread-index: AcnpC7NPZoxqa2Q+TymJ6g9B3JEugQ==
X-WBNR-Posting-Host: 12.108.45.6
From: =?Utf-8?B?R2VyaGFyZA==?= <Gerhard@xxxxxxxxxxxxxxxx>

Subject: RE: SharePoint
Date: Tue, 9 Jun 2009 07:08:01 -0700

Hi,

You have it right.

I have a class/dll that has that function in it. When called from the
console app, it works fine. When call from a simple .aspx page it gets
wierd
errors. Same when a web service calls the .dll. The .aspx app is in
IIS,
on
a Windows 2003 server with an admin account running it, the application
pool
it is assigned to is an admin account, and they are both admin accounts
on
SharePoint. Seems to me that if the application pool account has server
and
sharepoint admin permissions that I shouldn't be running into this,
especially since the same login can run a web service and do the same
thing
I
am trying to do through the api (I am trying to get away from the web
service
as it is inconsistent, not stable enough for a production environment as
far
as I am concerned).

I have also tried running it under extended priviledges, but that just
give
a different batch of errors.

Can you help on what security settings need to be in place to be able to
run
this without error (like it runs in the console app)? The .dll does run
stably in the console app and does exactly what I want it to do. There
must
be a trick to get it to do the same in a web app/web service that I
haven't
been able to locate after days of running searches and trying to find an
answer.

Thanks for your help

.



Relevant Pages

  • Re: security exception error
    ... do i need to have windows sharepoint services running on my development ... > clients you need to write a web service that you can reference, ... >> Dim subSite As SPWeb ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: security exception error
    ... SharePoint object model code will ONLY work on the SharePoint server itself. ... clients you need to write a web service that you can reference, ... > Dim mySite As SPSite = SPControl.GetContextSite ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Getting sharepoint logged on user information
    ... You can get the Current User in Sharepoint by using something like: ... Dim mySite As SPWeb = SPControl.GetContextWeb ... i need to identify the user login name of the person that is ... > logged on in sharepoint i need to get this information for a web service ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Need last logon time and account creation.
    ... Time account was created. ... and I find that the variable DomainName is assigned here: ... ' * Flag error Code ... Dim DomainName, DomainName2, strDN, concat, obj ...
    (microsoft.public.scripting.vbscript)
  • Re: Update subform field from pop-up form
    ... Private Sub cmdEncounter_Click ... Dim stLinkCriteria As String ... Me.Account = .Account ... Focus and On Activate events of the Subform FrmSubEvent with no luck. ...
    (microsoft.public.access.formscoding)