I seem to be experiencing a problem clearing the "altRecipient" attribute in Active Directory. When I run my program, it executes and returns successfully, but when I check either ADUC or ADSI Edit, the attribute is not cleared. Below is how I'm trying to clear the attribute:
termUser.Properties["altRecipient"].Clear();
I have also tried to clear the attribute by using:
termUser.Properties["altRecipient"].Value = null;
If I use the Clear() method on the "ipPhone" attribute, it works as expected. The only difference that I can see between the "ipPhone" attribute and the "altRecipient" attribute in ADSI Edit is that "ipPhone" is a Unicode String syntax whereas the "altRecipient" attribute has a Distinguished Name syntax.
Any help would be appreciated. Thank you.
Thank you for your response JPBLanc. I tried the "deliverAndRedirect" property and was still having a problem. I had a method that was setting three properties total and had the
termUser.CommitChanges();
being called at the end. I ended up calling
termUser.CommitChanges();
twice, once after
termUser.Properties["altRecipient"].Clear();
and again after setting the other two properties. It seems to be working now.....thank you for your help!
Related
I initially have used the answer to one of my previous questions as a helper to override the LabelFor methods. While it was doing exactly what I wanted, it did not satisfy the objective of "automatically modify functionality over the entire project without going through every page to add extra parameters" (, "*" for each LabelFor line in my case).
What I am thinking currently is either modifying LabelFor without adding extra parameter at the end, OR modifying the DisplayAttribute from DataAnnotations without renaming it and using my class name instead of Display.
When I tried to do LabelFor without adding extra parameter (again, refer to my question), no matter what I did, debugger automatically stepped out LabelFor without ever going into my LabelFor method, and was using default LabelFor.
When I tried Modifying DisplayAttribute , it only did what I wanted when I changed it from Display to myDisplay.
I used various sources, and I was getting mixed results, so I will ask here: Is there any way to modify/override either LabelFor or DisplayAttribute WITHOUT adding new parameter or renaming method respectively?
Thank you very much in advance!
No, there is not. In order to use method with the same name, it must have different parameters. Or just rename the method and use it from now on.
I'm referring to the excellent post :
Log4Net, how to add a custom field to my logging
But it doesn't give me the entire solution.
No problem to log a string like "This is a test", but If I want to log a variable, it's responding (null).
Here is my snipped code not working:
log4net.GlobalContext.Properties["versionid"] = Variables.IDVERSION;
Here is my working snipped code :
log4net.GlobalContext.Properties["versionid"] = " This is a test";
Although, IDVERSION is a public property systematically updated in my code c#.
Has anyone an idea How to solve this problem? I think I'm near the solution.
At the moment you call this:
log4net.GlobalContext.Properties["versionid"] = Variables.IDVERSION;
The property will hold the value of Variables.IDVERSION at that moment. It won't automagically track updates to the Variables.IDVERSION variable.
So if you set Variables.IDVERSION later in code, you need to do the assignment to Properties["versionid"] again.
When log4net evaluates context properties it calls the .ToString() method of the property value. So you could have dynamic property values if you have a reference as a value (I believe your idversion field is a value type eg. Int?).
See https://logging.apache.org/log4net/release/manual/contexts.html for more details
I'm using Azure Mobile Services and am running into an issue with the "UpdateAsync" method. For many of the properties I am storing in my item the UpdateAsync method works just fine. For others the update is completely ignored. Has anyone ran into an issue like this before? The call I am making is nothing fancy and the code is below.
It seems that the issue of the property not being updated may be limited to properties that contain a number in the name. For example CP20M is one of my properties that is not updating through this method. Another property, "Weight" updates without issue. Both are doubles. Does that make any sense? The only way I have of updating these fields that seems to work is to delete the entry and insert a new entry. That will get the appropriate values into all properties.
Any ideas are appreciated.
public async Task UpdateUserProfileItemAsync(UserProfile userProfile)
{
await _userProfileTable.UpdateAsync(userProfile);
await SyncAsync();
}
Just rename the field you are having problem with. It worked for me.
I'm getting a weird issue with nHibernate... I'm getting this exception:
Unable to resolve property: _Portal
when I try to commit an object graph. The strange thing is that when I search through the entire solution, I don't seem to have this particular property ANYWHERE within the project?!
Has anyone run into this particular case, and if so, what did they do to resolve?
I've ran into the same issue after upgrading nHibernate to 3.3 (from 3.1), as well as associated libraries (including FluentNhibernate). I have a parent object with a child collection, and when modifying the child collection, it would throw the same exception you received (with the nonexistant "_Namespace" property name, where "Namespace" was the first section of my actual namespace).
In our case, switching to SaveOrUpdate() is not an option, as we actually have a version of this object loaded in session as well, so we need Merge().
I don't know what other similarities there might be. For us it's a parent object with a child collection, using FluentNhibernate. Mapping on the parent object is Cascade.AllDeleteOrphan() for the child, and for the child to the parent, Cascade.None().
Unfortunately I can't find any other reports of this bug, so the solution for us was to just revert back to nHibernate 3.1 (and the associated binaries, like FluentNhibernate and Iesi.Collections). That's the only change, and then it works fine again.
Update on bug logged in JIRA [3234].
There is a bug logged for this in JIRA. The issue has not received any priority yet. Perhaps if you are experiencing this issue you can create an account and vote for the bug to be fixed.
https://nhibernate.jira.com/browse/NH-3234
Update on workaround posted for bug JIRA [3234].
As per Ondrej's comment on the bug, overriding the default merge listener on the session configuration with this code solves the issue for now. I am sure with the workaround posted it will be fixed officially soon.
public class UniDirectionalMergeFixListener : DefaultMergeEventListener
{
protected override IDictionary GetMergeMap(object anything)
{
var cache = (EventCache)anything;
var result = IdentityMap.Instantiate(cache.Count);
foreach (DictionaryEntry entry in cache)
result[entry.Value] = entry.Key;
return result;
}
}
So I solved my issue, but I'm not sure why this was the resolution.
In my project, I've abstracted out the use of nHibernate to be in its own project (*.Objects.nHibernate is the namespace). I did this because the client I work with doesnt' typically like using nHibernate, and I'm trying to get them onboard with using it.
What was happening is that this project has a few data models that are append only in the system... e.g., we never do an update. So, my "Repository" has to take that into account.
In my Commit() function within the repository, I serialize the object graph and then deserialize it to make a copy of the object for saving. What I was doing was saying to the session "_Session.Merge(...)", when I needed to say "_Session.SaveOrUpdate(...)" to get things to commit to the database properly... unsure why that made a difference, but that was the answer to the past two days.
Thx. for your help Rippo & Nickolay!
The workaround for this issue is to derive from DefaultMergeEventListener and override the following method like so:
protected override IDictionary GetMergeMap(object anything)
{
var cache = (EventCache) anything;
var result = IdentityMap.Instantiate(cache.Count);
foreach (DictionaryEntry entry in cache)
{
result[entry.Value] = entry.Key;
}
return result;
}
Then simply use this custom event listener when you construct your SessionFactory. I have posted additional details to the related NHibernate bug report: NH-3234
Few things to check:-
Do you have a backing field called _Portal on your domain?
Also does the WORD portal exist anywhere within your solution?
Do a clean solution and see what DLL's are left in any of your BIN folders.
Is your NHibernate configuration being serialized after it has been built? If so check you are using the latest version.
HTH
One more idea. NHibernate allow you to specify in mapping how to access your backing field or property. For example <property access="nosetter.pascalcase-underscore" name="Timestamp" /> will make NHibernate to set value through field _Timestamp. Do you have such access specifiers in your mapping?
I am looking to add custom properties to a tool part. I've been able to add the textbox as desired. I've been able to enter values and display it in the webpart.
The problem is when I edit the webpart - the panel pops up but the control I added is not populated with the previously entered value. See below:
I have followed the instructions on this website exactly as written - neither myself nor a more experienced Sharepoint developer co-worker is able to figure out what's going on here.
We thought that overriding the SyncChanges() method would allow for this - It seems it doesn't, unless our implementation isn't correct?
public override void SyncChanges()
{
DemoWebPart wp = (DemoWebPart)this.ParentToolPane.SelectedWebPart;
urls.Text = wp.ListValue;
}
We have also prefixed the urls property of the DemoWebPart.cs class with the following, to no avail:
[Browsable(true), Category("Miscellaneous"),
DefaultValue("Site Names"),
WebPartStorage(Storage.Shared / Personal / None),
FriendlyName("URLs"), Description("Text Property")]
(Having tried Storage.Shared, Storage.Personal, and Storage.None).
Any help you can provide would be greatly appreciated - thanks in advance!
This is the code I generally use for such properties:
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[System.ComponentModel.Category("Custom")]
[WebDisplayName("DisplayNameGoesHere")]
[WebDescription("Type the description of this web property here.")]
public string MyProperty{ get; set; }
I've never had any problems with it.
Only use the following if Webpart personalization is enbaled in central admin:
Personalizable(PersonalizationScope.Shared)
If it is not, remove the Personalizable attribute completely. Do not put in false or none in it, delete that attribute and use this:
WebPartStorage(Storage.Shared)
Suggestion :
Create a new WP
and use this article http://snahta.blogspot.com/2009/11/webpart-custom-properties.html
I have used this 100s of times , please give it try , it will work.
Thanks
Sandeep