Click here to Skip to main content
12,063,445 members (73,623 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ MFC
Hello,

I have developed an application in MFC,i am creating few XML file to store the data from my application,and i was suggested to save this XML files in the Active Directory
to keep them more save.So i need to use this Active Directory as a database to store the file and also to retrieve the data from the files which are saved in the Active directory.Kindly can any one guide me for this so that i can move a head with this.

Thanks in Advance.
Posted 23-Sep-12 16:46pm
Edited 1-Oct-12 21:59pm
v3
Comments
Rocky_Bas 24-Sep-12 23:10pm
   
Hello kindly suggest me how to do this.
Richard MacCutchan 25-Sep-12 4:47am
   
What do you mean by "store in the Active Directory"?
Rocky_Bas 25-Sep-12 5:17am
   
I want to save few xml files and log files in the Active Directory ,so how to do it using MFC
Argonia 2-Oct-12 9:42am
   
If under Active Directory you mean the folder in which your exe will be executed just use CFile (CStdioFile i think that class will do) and use only the name of the new folder. Don't use paths.This will make the new file in the same folder where your exe is located. Be careful with CFile:: modes
Rocky_Bas 2-Oct-12 22:02pm
   
Hi Argonia,I didn't mean to say the directory in which my exe is executed.I mean to say windows Active directory services.
Rocky_Bas 25-Sep-12 23:04pm
   
Is it possible to save the files in the Windows Server Active Directory.
JackDingler 2-Oct-12 15:23pm
   
The Windows Server Active Directory is not a filesystem. You cannot save files there.
Rocky_Bas 2-Oct-12 22:03pm
   
Hi JackDingler,so is there any possible to store some data in it.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

The following code example makes the existing "C:\MyFolder" directory a public file share. Later you can set passwords to that file share and also which users can access it. Below example is taken from MSDN, you can look around for more information with the ADSI interfaces. So the idea is keep in a NTFS folder and then set AD properties. Hope this helps...


IADsFileShare *pShare = NULL;
IADsContainer *pCont = NULL;
LPWSTR adsPath = L"WinNT://yourMachineName/LanmanServer";
HRESULT hr = S_OK;
 
hr = ADsGetObject(adsPath, IID_IADsContainer,(void**)&pCont);
if(FAILED(hr)) {goto Cleanup;}
 
hr = pCont->Create(CComBSTR("FileShare"), CComBSTR("Public"), (IDispatch**)&pShare);
 
if(FAILED(hr)) {goto Cleanup;}
 
hr = pShare->put_Path(CComBSTR("c:\\public"));
 
if(FAILED(hr)) {goto Cleanup;}
 
hr = pShare->SetInfo();
 
Cleanup:
    if(pCont) pCont->Release();
    if(pShare) pShare->Release();
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160204.4 | Last Updated 24 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100