விரைவான மற்றும் எளிதான: ஒரு நிகழ்வு ரிசீவர் ஒரு SPListItem என்ற SPFolder கிடைக்கும்

நான் அதை ஒப்பு கொள்ள வெறுக்கிறேன், but I struggled with this one all day. My event receiver needs to update a field of its parent folder. This little bit shows how to do it:

தனிப்பட்ட களைவதற்கு UpdateParentFolder(SPItemEventProperties பண்புகள்)
{

SPFolder thisItemFolder = properties.ListItem.File.ParentFolder;
thisItemFolder.Item["ZZ Approval Status"] = "Good news, அனைவரும்!";
thisItemFolder.Item.Update();


} // UpdateParentFolder

இந்த விஷயத்தில், I’m working with a document library and the properties are coming from an ItemAdded event.

The trick is that you can’t get the SPFolder of the item directly from the item itself (அதாவது. properties.ListItem.Folder is null). பதிலாக, go to the list item’s associated File and get the File’s folder.

</இறுதியில்>

என்னுடைய குழுசேர்!

Technorati குறிச்சொற்கள்:

ஒன் நினைத்தேன் "விரைவான மற்றும் எளிதான: ஒரு நிகழ்வு ரிசீவர் ஒரு SPListItem என்ற SPFolder கிடைக்கும்

ஒரு பதில் விட்டு

உங்கள் மின்னஞ்சல் முகவரி வெளியிடப்பட்ட முடியாது. தேவையான புலங்கள் குறிக்கப்பட்டன *