Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / November 2007

Tip: Looking for answers? Try searching our database.

Need help with error adding meetingBlob to a meeting class object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pucca - 02 Nov 2007 21:30 GMT
I got the following error:
System.ArgumentException: Value does not fall within the expected range.  At
System.DirectorySservcies.Interop.UnsafeNativeMethods.IAds.PutEx(Int32
InControlCode, String bstrName, Object vProp) at
System.DirecotryServices.PropertyValueCollection.set_Value(Object value)

public struct Blob
{
   public IntPtr pData;
   public int nLength;//the length of the actual data in nLength and
   public int nSize;//the length of the buffer for the data in nSize.

}
[DllImport("PaAsn.dll", CharSet = CharSet.Unicode)]
public static extern DE_ERRORS EncodeContextDefaults(ref IntPtr blob,
    [In, Out]ContextDefaults m);

// allocate memry for the blob
IntPtr pBlob = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CDS.Blob)));
// call the function passing the pointer to the blob
byrefEncodeContextDefaults
CDS.LibWrap.EncodeContextDefaults(ref pBlob, contextDefaults);
// copy the unmanaged blob to managed struct Blob
CDS.Blob blob = (CDS.Blob)Marshal.PtrToStructure(pBlob, typeof(CDS.Blob));
// allocate byte array with size of blob.nLength
byte[] meetingBlob = new byte[blob.nLength];
// marshal the data pointed to by pData into the byte array
System.Runtime.InteropServices.Marshal.Copy(blob.pData, meetingBlob, 0,
   blob.nLength);
defaultContext.Properties["meetingBlob"].Value = ((object)(blob));
defaultContext.CommitChanges();

Thank you.
Joe Kaplan - 02 Nov 2007 21:50 GMT
Shouldn't you be passing in the byte array, meetingBlob, and not the
structure, blob, to the DirectoryEntry?

Joe K.

Signature

Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--

>I got the following error:
> System.ArgumentException: Value does not fall within the expected range.
[quoted text clipped - 30 lines]
>
> Thank you.
Pucca - 03 Nov 2007 00:26 GMT
Yes, you're absolutely right.  Thank you very much!  
Signature

Thanks.

> Shouldn't you be passing in the byte array, meetingBlob, and not the
> structure, blob, to the DirectoryEntry?
[quoted text clipped - 35 lines]
> >
> > Thank you.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.