how get items from public calendar? I tried the following, but it appears to me the error object not found
var ol = new ActiveXObject("outlook.application");
var calendar = ol.getnamespace("mapi").folders("public folder – name").Folders("All Public Folders").Folders("Company").Folders("Room").items
Thank you
Related
I have several accounts configured in Outlook. Now I am trying to get the StoreID of an Outlook mailItem. For example if I select a message from the inbox folder of an account, let's say, account1, I want to get its StoreID, and if I select a message from the inbox folder of another Outlook account, let's say, account2, I want to get the its corresponding StoreID.
I have created an extension method to get the StoreID:
public static string GetStoreID(this Outlook.MailItem omi)
{
Outlook.Folder folder = null;
Outlook.Store store = null;
string storeID = null;
try
{
folder = (Outlook.Folder)omi.Parent;
store = folder.Store;
storeID = store.StoreID;
}
catch (Exception ex)
{
Log.Error("GetStoreID: An error occurred while getting mail item storeID. " + ex.ToString());
}
finally
{
folder = null;
store = null;
}
return storeID;
}
Is it correct or is there any other way which is better?
Your method is fine. Or you can make it even faster - simply retrieve the PR_STORE_ENTRYID MAPI property (DASL name "http://schemas.microsoft.com/mapi/proptag/0x0FFB0102") using MailItem.PropertyAccessor.GetProperty and convert it to a string using MailItem.PropertyAccessor.BinaryToString.
Your code works, so it appears you are asking for any other approach you could take to get the StoreID string.
Whether one approach is "better" than any other approach is purely subjective and entirely context specific.
Another way you could do this, would be to instead get the StoreID from the Explorer object (rather than the MailItem). If you have an "Explorer Wrapper" class in your add-in, you could have something like the following for your backing-fields and constructor:
private Outlook.Explorer _myExplorer;
private Outlook.Folder _myFolder;
private Outlook.Store _myStore;
private string _myStoreID;
public OutlookExplorerWrapper(Outlook.Explorer explorer)
{
_myExplorer = explorer;
_myFolder = (Outlook.Folder)_myExplorer.CurrentFolder;
_myStore = _myFolder.Store;
_myStoreID = _myStore.StoreID;
}
my app is crashing and is returning me this error on the console. My build works fine but when I try to run unit tests I get this.
'NSError' is not supported as an RLMObject property. All properties must be primitives, NSString, NSDate, NSData, RLMArray, or subclasses of RLMObject
this is what my model looks like...
public class Place: Object {
// mongo id
public dynamic var _id: String = ""
// google id
public dynamic var google_id: String = ""
// name
public dynamic var name: String = ""
// score
public dynamic var score: Double = 0
// types
public let types = List<TypeObject>()
public dynamic var typeFormat: String = ""
// address
public dynamic var address: Address?
// geographic location
public dynamic var location: GeoJSON?
// phone
public dynamic var phone: Phone?
// open now
public dynamic var openNow: Bool = false
// hours
public let hours = List<Hours>()
// utc offset
public dynamic var utcOffset: Int = 0
// website
public dynamic var website: String = ""
// price level
public dynamic var priceLevel: Int = 0
// created at, updated at
public dynamic var createdAt: String = ""
public dynamic var updatedAt: String = ""
// visit
public let history = List<Visit>()
public dynamic var visitValue: VisitValue?
public dynamic var voteValue: VoteValue?
// reviews
public let reviews = List<Review>()
// photos
public let photos = List<Photo>()
...
the model class is huge so I omitted the initializers. One thing to note, is that this class does not contain any NSError types but contains functions, getters, and setters, all of which do not throw any sort of errors. I don't know if that affects the model at all but they have all been working fine up this point. All these errors started happening when I upgrade to Swift 2 and XCode 7. I'm really stumped over here, any help would be great.
UPDATE
my problem was that I added a var error: NSError? accidentally in between two functions within my model while I was optimizing code. I couldn't find it because my model is packed with helper functions and what not. So I hope this helps anyone who runs into this problem to just leave models alone and put any code that isn't schema related outside of the model itself.
Can you add an "Exception Breakpoint"? If so, you can then figure out which property in your model is causing the issue based off of the name variable passed into this method in RLMProperty.mm:
initSwiftPropertyWithName:indexed:property:instance:
which is ultimately calling setTypeFromRawType which is where the error is generated.
My guess is it is one of the object relationship properties because the error occurs when it is evaluating your model and checking if the property points to a subclass of Realm Object.
I'm developing windows phone 8 application. In which I have to share the application's download link on Facebook and Twitter.
Before publishing the application on to the windows phone store, How could I know the download link of the application.
Because we have to implement the share functionality before publishing the application.
I'm looking forward for your responses.
Thanks & Regards,
Suresh
Basically your application download link format is as follow :
http://windowsphone.com/s?appid=<ApplicationId>
with <ApplicationId> is value of ProductID attribute of App element in WMAppManifest.xml file. That ProductID in WMAppManifest.xml will be overridden when you submit the Apps to Marketplace, so avoid hardcoding it. This post demonstrates how to get <ApplicationId> from manifest file as well as how to share it using Microsoft.Phone.Tasks.ShareLinkTask.
UPDATE :
To summarize, create a helper class to read ApplicationID from WMAppManifest.xml file :
public class DeepLinkHelper
{
private const string AppManifestName = "WMAppManifest.xml";
private const string AppNodeName = "App";
private const string AppProductIDAttributeName = "ProductID";
public static string BuildApplicationDeepLink()
{
var applicationId = Guid.Parse(GetManifestAttributeValue(AppProductIDAttributeName));
return BuildApplicationDeepLink(applicationId.ToString());
}
public static string BuildApplicationDeepLink(string applicationId)
{
return #"http://windowsphone.com/s?appid=" + applicationId;
}
public static string GetManifestAttributeValue(string attributeName)
{
var xmlReaderSettings = new XmlReaderSettings
{
XmlResolver = new XmlXapResolver()
};
using (var xmlReader = XmlReader.Create(AppManifestName, xmlReaderSettings))
{
xmlReader.ReadToDescendant(AppNodeName);
if (!xmlReader.IsStartElement())
{
throw new FormatException(AppManifestName + " is missing " + AppNodeName);
}
return xmlReader.GetAttribute(attributeName);
}
}
}
Then you can get/share download link this way :
new Microsoft.Phone.Tasks.ShareLinkTask()
{
Title = "My Application Deep Link",
Message = "My Application Deep Link",
LinkUri = new Uri(DeepLinkHelper.BuildApplicationDeepLink())
}.Show();
Credit to Pedro Lamas for all above codes.
I am trying to retrieve multiple images from isolated storage using listbox but i am not sure why it just only retrieve the lastest image from isolated storage.Therefore hope anyone could help me make amends to my code or could provide me with sample code that works which is about the same as mine.Thanks.
My code :
private void LoadFromLocalStorage(string imageFolder, string imageFileName )
{
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!isoFile.DirectoryExists(imageFolder))
{
isoFile.CreateDirectory(imageFolder);
}
string filePath = Path.Combine(imageFolder, imageFileName);
using (var imageStream = isoFile.OpenFile(filePath, FileMode.Open, FileAccess.Read))
{
var imageSource = PictureDecoder.DecodeJpeg(imageStream);
BitmapImage bi = new BitmapImage();
ListBoxItem item = new ListBoxItem();
bi.SetSource(imageStream);
item.Content = new Image()
{
Source = bi, MaxHeight = 100, MaxWidth = 100 };
listBox1.Items.Add(item);
}
It would be helpful if you tell what results are you getting.
Do you see only 1 element?
Do you see multiple elements and they are the same?
Do you see multiple elements and only 1 shows a picture and other are empty?
Anyway this is not a proper way to treat listbox. But first things first.
This line doesn't do anything useful:
var imageSource = PictureDecoder.DecodeJpeg(imageStream);
This code should work (it seems), but there may be an error outside the code. How many times this function is called and what parameters are passed - that is what actually matters.
But I would change the code to use Data Binding and proper ItemsSource.
Create class for items
public class MyImage
{
public string FilePath {get; set;}
public ImageSource LoadedSource {get; set;}
}
Create an ObservableCollection<MyImage>() and fill it with your data.
Bind it to ListBox by setting ItemsSource
Design a proper ItemTemplate with Image and Binding:
<Image Source={Binding LoadedSource}/>
This setup will help you debug the issues easily and localize the problem. It is likely that you are calling your original function incorrectly.
I am as many others following the MVC Music Store Tutorial, but I'm stuck with an error.
At page 48, the tutorial says to write an ActionResult-view:
public ActionResult Index()
{
var genres = storeDb.Genres.ToList()
return View(genres);
}
but I get an error on genres. Visual Web Developer says "value cannot be null".
what should I set genres to? var genres = new ??
Thank you!
Make sure you have specified a connection string to your database in web.config. Also make sure you initialize the storeDb variable before using it:
public ActionResult Index()
{
var storeDb = new StoreDbDataContext(); // Replace this with the actual type
var genres = storeDb.Genres.ToList();
return View(genres);
}