Microsoft.MetadirectoryServices.At tributeNotPresentException: Attribute "blah" is not present.

Hi,

I am trying to write a custom extension in Visual Basic that creates Exchange mail-enabled users (MEUs) in my target directory, for each mailbox in my source directory. I have the code below in my source MA extension, and have specified "targetAddress" as the flow rule name under the advanced attribute flow on the source MA. However, when I run a sync on the source MA, it returns the error "Microsoft.MetadirectoryServices.AttributeNotPresentException: Attribute "targetAddress" is not present."

Any idea what I could be doing wrong?

Thanks in advance,

Adam

 Case "targetAddress"
                If csentry("targetAddress").IsPresent Then
                    mventry("targetAddress").Value = csentry("targetAddress").Value
                Else
                    mventry("targetAddress").Value = ("SMTP:" & csentry("mailNickname").Value & "@contoso.com")
                End If

May 28th, 2014 3:13pm

Can you paste the whole exception?
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2014 4:03pm

Hi Brian,

This is everything from the Call Stack Information:

Microsoft.MetadirectoryServices.AttributeNotPresentException: Attribute "targetAddress" is not present.
   at Microsoft.MetadirectoryServices.Impl.AttributeImpl.get_Value()
   at Mms_Metaverse.MVExtensionObject.Provision(MVEntry mventry)

Extension File Name: MVExtension.dll

Extension Type: provisioning

Thanks,

Adam

May 28th, 2014 4:22pm

So that's in your Provisioning code but you pasted a rules extension. Can you check your provisioning code?
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2014 4:24pm

Hmmm, interesting, so here is a portion of my provisioning code. I am using the ExchangeUtils.CreateMailEnabledUser method:

   dn = adMA.EscapeDNComponent("CN=" + mventry("cn").Value).Concat(container)
                If 0 = adMA.Connectors.Count Then
                    If mventry("legacyExchangeDN").IsPresent Then
                        csentry = ExchangeUtils.CreateMailEnabledUser(adMA, dn, nickName, targetAddress)
                        csentry("proxyAddresses").Values.Add("SMTP:" & mventry("mail").Value)
                    Else
                        csentry = adMA.Connectors.StartNewConnector("user")
                        csentry.DN = dn
                        If mventry("mail").IsPresent Then
                        End If
                        csentry.CommitNewConnector()
                    End If

May 28th, 2014 4:31pm

Where do you set the targetAddress variable?
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2014 4:37pm

It was up above from what I sent you, here:

Public Sub Provision(ByVal mventry As MVEntry) _
    Implements IMVSynchronization.Provision

        Dim adMA As ConnectedMA
        Dim csentry As CSEntry
        Dim nickName, mailboxMDB, SMTPemail, targetAddress, container, stralias() As String
        Dim dn As ReferenceValue
        Dim sid As Byte()

        If mventry.ObjectType = "person" Then
            Try
                adMA = mventry.ConnectedMAs("PRD")

                nickName = mventry("uid").Value
                targetAddress = mventry("targetAddress").Value
                'mailboxMDB = mventry("info").Value
                sid = mventry("objectSID").BinaryValue

May 28th, 2014 4:40pm

Brian,

Thanks for the tip. Even though you never responded to my last post, your question about where I was setting the targetAddress variable got me thinking. I changed the variable to the following, and things started to work!

targetAddress = ("SMTP:" & mventry("mailNickname").Value & "@contoso.com")

Adam

Free Windows Admin Tool Kit Click here and download it now
May 29th, 2014 12:27pm

Sorry I missed the last reply yesterday. Yes that will work - it will fail though if mailNickname is never null. You may want to do the IsPresent test and throw an UnexpectedDataException if you're missing mandatory attributes.
May 29th, 2014 2:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics