Discussion:
Default View
(too old to reply)
skg
2006-04-06 22:14:47 UTC
Permalink
I am setting default view using following code snippet. it gets set for some
of the folders which does not have any views.

But if a folder has an existing view it does not get sets.

Appreciate any suggestiosn.

SPropValue ival;

val.ulPropTag = PR_DEFAULT_VIEW_ENTRYID;

val.Value.bin = plSrc[0].Value.bin;

hRes= pIlFolder->SetProps(1, &val, NULL);

hRes= plIFolder->SaveChanges(0);

thx
Michael Tissington
2006-04-07 05:52:59 UTC
Permalink
This is what you need to do

// Folder View Properties
#define PR_FOLDER_XVIEWINFO_E PROP_TAG( PT_BINARY, 0x36E0 ) // Current View
#define PR_FOLDER_VIEWFLAGS PROP_TAG( PT_LONG, 0x36E1 ) // Only show views
created for this folder


SPropValue spv = {0};

LPBYTE pCursor = NULL;
DWORD dwViewFlags = 0;
ULONG ulcBytes = 0;
BSTR bstrView = L"View Name";

if (User_Defined_View)
dwViewFlags = 0x00000000;
else
dwViewFlags = 0x0044000D;

ulcBytes = 8 + ((wcslen(bstrView) + 1) * 2);
gpfnAllocateBuffer(ulcBytes, (LPVOID*)&spv.Value.bin.lpb);

spv.ulPropTag = PR_FOLDER_XVIEWINFO_E;
spv.Value.bin.cb = ulcBytes;

// Initialize the cursor
pCursor = spv.Value.bin.lpb;

// Set the version
*((DWORD*)pCursor) = 0;
pCursor += sizeof(DWORD);

// Set the flags
*((DWORD*)pCursor) = dwViewFlags;
pCursor += sizeof(DWORD);

// Set the name
wcscpy((WCHAR*)pCursor, bstrView);

SetPropsInternal(1, &spv, NULL);

gpfnFreeBuffer(spv.Value.bin.lpb);
--
Michael Tissington
http://www.oaklodge.com
http://www.sqlview.net
Post by skg
I am setting default view using following code snippet. it gets set for
some of the folders which does not have any views.
But if a folder has an existing view it does not get sets.
Appreciate any suggestiosn.
SPropValue ival;
val.ulPropTag = PR_DEFAULT_VIEW_ENTRYID;
val.Value.bin = plSrc[0].Value.bin;
hRes= pIlFolder->SetProps(1, &val, NULL);
hRes= plIFolder->SaveChanges(0);
thx
skg
2006-04-07 19:26:53 UTC
Permalink
Thanks!!! a lot that did it.
Post by Michael Tissington
This is what you need to do
// Folder View Properties
#define PR_FOLDER_XVIEWINFO_E PROP_TAG( PT_BINARY, 0x36E0 ) // Current View
#define PR_FOLDER_VIEWFLAGS PROP_TAG( PT_LONG, 0x36E1 ) // Only show
views created for this folder
SPropValue spv = {0};
LPBYTE pCursor = NULL;
DWORD dwViewFlags = 0;
ULONG ulcBytes = 0;
BSTR bstrView = L"View Name";
if (User_Defined_View)
dwViewFlags = 0x00000000;
else
dwViewFlags = 0x0044000D;
ulcBytes = 8 + ((wcslen(bstrView) + 1) * 2);
gpfnAllocateBuffer(ulcBytes, (LPVOID*)&spv.Value.bin.lpb);
spv.ulPropTag = PR_FOLDER_XVIEWINFO_E;
spv.Value.bin.cb = ulcBytes;
// Initialize the cursor
pCursor = spv.Value.bin.lpb;
// Set the version
*((DWORD*)pCursor) = 0;
pCursor += sizeof(DWORD);
// Set the flags
*((DWORD*)pCursor) = dwViewFlags;
pCursor += sizeof(DWORD);
// Set the name
wcscpy((WCHAR*)pCursor, bstrView);
SetPropsInternal(1, &spv, NULL);
gpfnFreeBuffer(spv.Value.bin.lpb);
--
Michael Tissington
http://www.oaklodge.com
http://www.sqlview.net
Post by skg
I am setting default view using following code snippet. it gets set for
some of the folders which does not have any views.
But if a folder has an existing view it does not get sets.
Appreciate any suggestiosn.
SPropValue ival;
val.ulPropTag = PR_DEFAULT_VIEW_ENTRYID;
val.Value.bin = plSrc[0].Value.bin;
hRes= pIlFolder->SetProps(1, &val, NULL);
hRes= plIFolder->SaveChanges(0);
thx
Loading...