and sorry for a poor title of the question
I´m trying to get all free rooms (not booked ones) from my exchange server. The thing is that I also get the rooms I have booked but nobody has accepted.
I would like to exclude them from the list after I book the room.
This is the code I use to book a room
ExchangeService service;
//...code to new-up and config service
var request = new Appointment(service)
{
Subject = booking.Subject,
Start = booking.Start,
End = booking.End,
Location = booking.Room
};
request.RequiredAttendees.Add(booking.Person);
request.RequiredAttendees.Add(booking.Room);
request.Save(SendInvitationsMode.SendOnlyToAll);
To note I have tried to call request.Accept() straight after Save() but without that "realy booking" the room. Pressing accept in Outlook is the only "fix". Needlessly to say I have tried everything I could find about this issue (I do not work with Exchange regularly).
And then the code to get free rooms
var rooms = service.GetRooms(locationAddress);
// all the meeting rooms at location
var rooms= rooms.Select(i => new AttendeeInfo { SmtpAddress = i.Address, AttendeeType = MeetingAttendeeType.Room });
// Get all availabilites from all rooms at given locations
var availability = service.GetUserAvailability(rooms, timeframe, AvailabilityData.FreeBusy);
foreach (var a in availability.AttendeesAvailability)
{
// Here we always get all the free rooms
// including the ones we booked earlier
// UNTIL somebody clicks accept in Outlook and then it does not appear here!?
}
I can´t see that the rooms are marked differently before they are accepted in Outlook so I can´t differentiate between them and pull out them ones I don´t want.
I also really think that those rooms should not be available so there must bee some enum/tick/mark I can put on the room before booking it but I totally missing it.
Edit
I realy don't understand why there is no option for AvailabilityData.Free in the enum in the GetUserAvailability method (only FreeBusy, FreeBusyAndSuggestions and Suggestions but no Free only!?)
Ok this is rather silly... the code (I inherited) did not include code to actually remove rooms that where taken (busy). I only just noticed this...
The code to fix this is simply this one
var busyRoomToRemove = a.CalendarEvents.ToList().Find(x => x.FreeBusyStatus == LegacyFreeBusyStatus.Busy);
a.CalendarEvents.Remove(busyRoomToRemove);
Sorry for the inconvenience :-)
Related
Hello friends I need help:
Here I specify what I am doing:
1.- I am overriding the release method of Employee Timecard, do a validation to get the project's default branch code, and then insert it into the project's transaction screen.
public class TimeCardMaint_Extension : PXGraphExtension<TimeCardMaint>
{
#region Event Handlers
public delegate IEnumerable ReleaseDelegate(PXAdapter a);
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate InvokeBase)
{
PXGraph.InstanceCreated.AddHandler<RegisterEntry>((graph) =>
{
graph.RowInserted.AddHandler<PMTran>((sender, e) =>
{
EPTimecardDetail detail = PXResult<EPTimecardDetail>.Current;
if (detail != null)
{
var tran = (PMTran)e.Row;
PMProject project = PXSelect<PMProject,
Where<PMProject.contractID, Equal<Required<PMProject.contractID>>>>.Select(Base, detail.ProjectID);
if (project != null)
{
tran.BranchID = project.DefaultBranchID;
}
}
});
});
return InvokeBase(adapter);
}
#endregion
}
Here we see the Transactions screen of the project, make the correct change.
So far everything perfect:
However, if I check the Journal Transactions screen, it has generated two new entries, it should really only generate a single journal entry as it does by default in acumatica.
Due to these consequences, it is because I have modified the employee's time card, in the release method, I don't know what is happening:
I need you to tell me what I should do or what I am doing wrong, really I only have to modify the Project Transactions screen and the others should not affect I hope I have been clear..
Digging through the code, the release function for the Project Transactions groups them together by branch.
This is executed at each entry:
Batch newbatch = je.BatchModule.Insert(new Batch
{
Module = doc.Module,
Status = BatchStatus.Unposted,
Released = true,
Hold = false,
BranchID = branchID,
FinPeriodID = parts[1],
CuryID = parts[2],
CuryInfoID = info.CuryInfoID,
Description = doc.Description
});
As you can see, it adds to the batch of the branch. This would filter out one document for each type, even though it could be separate on the line:
Since you are having one time card, and then two branches, it would post one time card to one branch, then the other time card to the other branch. If you were to change the line item for each, you would have to override the entire release functions. So based on spending time combing through the project code, and knowing the GL processes, it seems to be operating as intended for acumatica.
Now to your point to bring it into one, I would override the Release function of the PX.Objects.PM.RegisterReleaseProcess graph:
public virtual List<Batch> Release(JournalEntry je, PMRegister doc, out List<PMTask> allocTasks)
You would make a copy of the entire function, and then create one batch, and then override the transaction. The document would still be tagged with the employee's primary branch, but each line would then be updated to the proper branch.
NOTE: This would need to be tested thoroughly each update to Acumatica. You would also need to verify from the accounting side that all of the reporting is correct. Some companies may report on the document's branch rather than the transactions, or ignore it and look at the account that it is hitting altogether.
I hope this helps get you to the desired solution!
I do a query on a path then add new data on the same path then read again with the same query and the new data is not in the result. I can see the new data in my FB console and if I restart my app, it will show. It's like I'm reading from cached data. What is wrong?
public static void GetScores(string readDbPath)
{
FirebaseDatabase.DefaultInstance.GetReference(readDbPath).OrderByChild("score")
.LimitToLast(Constants.FIREBASE_QUERY_ITEM_LIMIT)
.GetValueAsync().ContinueWith(task =>
{
if (task.IsFaulted)
{
// Handle the error...
Debug.LogError("FirebaseDatabase task.IsFaulted" + task.Exception.ToString());
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
// Do something with snapshot...
List<Score> currentScoreList = new List<Score>();
foreach (var rank in snapshot.Children)
{
var highscoreobject = rank.Value as Dictionary<string, System.Object>;
string userID = highscoreobject["userID"].ToString();
int score = int.Parse(highscoreobject["score"].ToString());
currentScoreList.Add(new Score(score, userID));
}
OnStatsDataQueryReceived.Invoke(currentScoreList); // catched by leaderboard
}
});
}
It's very likely that you're using Firebase's disk persistence, which doesn't work well with Get calls. For a longer explanation of why that is, see my answer here: Firebase Offline Capabilities and addListenerForSingleValueEvent
So you'll have to choose: either use disk persistence, or use Get calls. The alternative to calling Get would be to monitor the ValueChanged event. In this case your callback will be invoked immediately when you change the value in the database. For more on this, see the Firebase documentation on listening for events.
This post was deleted stating it was just additional infos on my question. If fact it is the solution which is to use GoOffline() / GoOnline().
Thanks Frank for the detailed answer.
I tried with
FirebaseDatabase.DefaultInstance.SetPersistenceEnabled(false)
but the problem stayed the same. Using listeners is not what I want since every time a player would send a score, every player on the same path would receive refreshed data so I'm worried about b/w costs and performance.
The best solution I just found is to call before using a get
FirebaseDatabase.DefaultInstance.GoOnline();
then right after I get a response I set
FirebaseDatabase.DefaultInstance.GoOffline();
So far no performance hit I can notice and I get what I want, fresh data on each get. Plus persistence if working off line then going back.
I am trying to code an app for Android (C# - Xamarin), and I loaded a PBF file, I can find route between two places (coordinates). But I dont know how can I get informations about place where I am actualy (by coordinates). I want to know something about road (street) where I am, for example street name, speed limit...
I did not found anything about this. I hope somebody knows how to do that.
DISCLAIMER: I'm the original author of OsmSharp/Itinero.
You can use this code to get info about an edge at a given location:
var routerDb = RouterDb.Deserialize(...); // load routerdb here.
var router = new Router(routerDb);
var routerPoint = router.Resolve(Vehicle.Car.Fastest(), new Coordinate(51.269692005119616f, 4.783473014831543f));
var edge = routerDb.Network.GetEdge(routerPoint.EdgeId);
var attributes = routerDb.GetProfileAndMeta(edge.Data.Profile, edge.Data.MetaId);
var speed = Vehicle.Car.Fastest().Speed(attributes);
The attributes are a collection of the orginal OSM tags, speed is a speed estimate for the Car profile.
I'm writing a simple C# application that answers a Lync call and depending on a database value, forwards it to another phone number. That works perfectly. However, sometimes I want to forward the call to the user's voicemail. I can't figure out how to get the URI for the voicemail box :(
Assuming I'm in the handler for a ConversationAdded event. I've tried this:
Conversation conv = args.Conversation;
string voicemailURI = String.Format("{0};opaque=app:voicemail",conv.SelfParticipant.Contact.Uri);
// the contact returned here, however, does not contain the opaque=app:voicemail
Contact forwardContact = lync.ContactManager.GetContactByUri(voicemailURI);
Also:
Conversation conv = args.Conversation;
// following throws ArgumentException: Value does not fall within the expected range
Phone voicemail = lync.Self.GetPhone(ContactEndpointType.VoiceMail);
string voicemailURI = voicemail.Endpoint.Uri
Contact forwardContact = lync.ContactManager.GetContactByUri(voicemailURI);
UC voicemail is setup and working otherwise. I'm not sure what the term is exactly, but it's handled by Exchange and the messages appear in my Inbox. If I just let the phone ring it will eventually end up in voicemail, but my app knows it should go there right away so I'd like to forward it immediately.
I guess I'm not quite sure why you care about getting the contact? Your first example will give you the URI to go directly to voicemail. At that point you can just do this:
var automation = LyncClient.GetAutomation();
var conversationModes = AutomationModalities.Audio;
var conversationSettings = new Dictionary<AutomationModalitySettings, object>();
List<string> participants = new List<string>();
Conversation conv = args.Conversation;
string voicemailURI = String.Format("{0};opaque=app:voicemail",conv.SelfParticipant.Contact.Uri);
participants.Add(voicemailUri);
automation.BeginStartConversation(AutomationModalities.Audio, participants, null, StartConversationCallback, automation);
i am building a csharp application and i would like a dropdown list of all users in my outlook global address book (the same one when i click on To: from outlook gui. is this possible to get this progrmaticall? what are the security requirements here?
Security ramifications, in addition to the Outlook dependency left me unable to use this approach, in the past. As a result, I ended up building this in the form of an LDAP query. Another plus is that, (in response to your other question) you will be able to extract contact information because this information is stored in the Active Directory.
DISCLAIMER: It has been almost five years since I have looked at this code, so I'm afraid I no longer fully understand the query. Hopefully it's enough to get you started, however.
DirectoryEntry adFolderObject = new DirectoryEntry();
DirectorySearcher adSearcher = new DirectorySearcher(adFolderObject);
adSearcher.SearchScope = SearchScope.Subtree;
adSearcher.Filter = "(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))";
foreach (SearchResult adObject in adSearcher.FindAll())
{
Console.WriteLine("CN={0}, Path={1}", adObject.Properties["CN"][0], adObject.Path);
}