IsProfile and $Name item

I want to re-architect an application in production and basically turn what is currently a profile document into a normal Notes document. Do I simply have to remove the $Name item from the profile document or is there more to it?

When I do this, the IsProfile property does show False but I am concerned I may be simplifying the issue.

Thanks for an help anyone can give me. I hope the request is crispy enough ?! Rob.

Subject: IsProfile and $Name item

There’s more to it. Profile documents probably have a Flag value set that let’s Notes know it’s a profile.

It would be simpler to create a new document, copy all items from the profile into it, then delete the profile document.

Subject: RE: IsProfile and $Name item

OK thanks. I’ve tried this and had problems when it got to a $FILE item – because one of the rich text fields had an attachment. Would I have to extract the attachment and then embed it into the new document?

Subject: RE: IsProfile and $Name item

Forget that last post. My problem was down to a corrupt document. Here’s my code just in case it helps anyone. It works fine. Thanks Graham for your confirmation of the way to go!

Sub Initialize

On Error Goto ErrorHandler



' This is test code just to try something out



Dim sess As New NotesSession

Dim db As NotesDatabase

Set db = sess.CurrentDatabase



' Get the PEP profile document



Dim PEP As NotesDocument

Set PEP = db.GetProfileDocument("PEP")

If PEP.IsNewNote Then

	Messagebox "There wasn't a PEP profile document"

	Exit Sub

End If



' Get a collection of all response documents



Dim PEPResponses As NotesDocumentCollection

Set PEPResponses = PEP.Responses



' Get a new profile document called PEPLink



Dim PEPLink As NotesDocument

Set PEPLink = db.GetProfileDocument("PEPLink")



' Now need to make the PEP profile document a normal document



Dim NewPep As NotesDocument

Set NewPEP = db.CreateDocument



Call PEP.CopyAllItems(NewPEP)



Dim DollarName As NotesItem

Set DollarName = NewPEP.GetFirstItem("$Name")

If Not (DollarName Is Nothing) Then

	Call DollarName.Remove

End If



Call NewPEP.Save(True, False)	



' Get the Unique ID of the new PEP document



Dim PEPUNID As String

PEPUNID = NewPEP.UniversalID



' Store the PEP UNID into the new PEPLink profile



PEPLink.PEPUNIDTX = PEPUNID

Call PEPLink.Save(True, False)



' Now attach the response documents to the new PEP



Dim doc As NotesDocument

Set doc = PEPResponses.GetFirstDocument

Do Until doc Is Nothing

	Call doc.MakeResponse(NewPEP)

	Call doc.Save(True, False)

	Set doc = PEPResponses.GetNextDocument(doc)

Loop



' Finally, remove the old PEP



Call PEP.Remove(True)



Exit Sub

ErrorHandler:

Call LogError()



Select Case Err

Case 4249

	Resume Next

Case Else

	Messagebox Error$

	Resume ExitAfterError

End Select

ExitAfterError:

End Sub